Skip to content

Instantly share code, notes, and snippets.

View AugFJTan's full-sized avatar

AugFJTan

View GitHub Profile
@AugFJTan
AugFJTan / third-place.md
Created February 1, 2024 00:04
Third Places

How to Create Third Places?

mindmap
Third Place
  Pubs
  Libraries
  Cafés
@AugFJTan
AugFJTan / quirky_python.py
Created September 25, 2018 04:05
Quirky Python
# File : quirky_python.py
# Author: AugFJTan
# Date : 25/09/18
############################################
# Swap values without a temporary variable #
############################################
# Initial values
a = 5
@AugFJTan
AugFJTan / SHA256.c
Created February 26, 2018 03:19
C implementation of SHA-256
/* File : SHA256.c
* Description: C implementation of SHA-256 (256-bit Secure Hash Algorithm).
*
* Author : AugFJTan
* Last Modified 18 Feb 2018 06:50 PM
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@AugFJTan
AugFJTan / ChairProblem.cpp
Last active January 8, 2018 04:57
The Chair Problem
// File : ChairProblem.cpp
// Description: A problem involving a store room and some chairs...
//
// Author : AugFJTan
// Last Modified 08 Jan 2018 11:56 AM
#include <iostream>
class Space
{
@AugFJTan
AugFJTan / RME-Programmers-2nd-Lesson-Overview.md
Last active September 17, 2017 01:16
RME Programmers 2nd Lesson Overview

1st Lesson Recap

  • Basic concept of Git as a distributed version control system
  • Setting up Git
# You only need to run username and e-mail config once on your computer
git config --global user.name "your-name"
git config --global user.email "[email protected]"
@AugFJTan
AugFJTan / write_portable_c_code_windows.md
Created August 14, 2017 15:32
How to write portable C code across different Windows versions

Background

MinGW is not really a well suited environment for C programming, but if your university course requires you to use it, then by all means ensure that you use it efficiently without letting it get in your way. Usually, MinGW comes with a (rather lousy) Windows port of the GNU Compiler Collection (GCC). Some IDEs use GCC via MinGW to invoke the GNU C compiler to compile C code. Here are some tips to ensure that your code is portable across different versions of Windows for your university C programming assignment:

Tip 1: Check the encoding

Unsurprisingly, Microsoft had neglected their command line. For years, the default encoding for the command prompt was Code Page 437. This meant that only a limited character set could be displayed on it. It was not until Windows 10 that the default encoding changed to UTF-8. This presents some portability problems. From experience I can tell you that your lecturer will expect you to use the default settings on a specific version of Windows. To check th