Skip to content

Instantly share code, notes, and snippets.

View jenglamlow's full-sized avatar

Low Jeng Lam jenglamlow

View GitHub Profile

Most active GitHub users in Malaysia

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Thu, 20 Jul 2017 15:24:53 GMT till Fri, 20 Jul 2018 15:24:53 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 3)
@jenglamlow
jenglamlow / .tmux.conf
Last active November 9, 2017 12:02
My configuration
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# Change prefix key
unbind C-b
set -g prefix C-a
bind C-a send-prefix
@jenglamlow
jenglamlow / tasks.json
Created August 6, 2017 14:19
Visual Studio Code Python Task Runner
{
"version": "2.0.0",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"tasks": [
{
"taskName": "Run",
"command": "python",
@jenglamlow
jenglamlow / launch.json
Last active January 1, 2019 20:31
CodeForces Visual Studio Code C++ settings and template. Compile the cpp code inside the folder, read input.txt and output to output.txt
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
@jenglamlow
jenglamlow / launch.json
Last active August 6, 2017 10:00
Visual Studio Code (v1.14) C++ build project settings. F7 to build, F8 to build and run, F5 to Debug. This tasks setting is to build dedicated binary for the selected cpp file. Useful for quick C++ coding testing or algorithm practise.
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
@jenglamlow
jenglamlow / Host.java
Created July 20, 2017 15:14
Maven Hibernate Example Project
package com.jeng.pgtest.model;
import javax.persistence.*;
@Entity
@Table(name = "HOST")
public class Host {
@Id @GeneratedValue
@Column(name = "id")
private int id;
@jenglamlow
jenglamlow / naive_traverse.cpp
Last active January 8, 2020 14:47
Write a traverse(int N) function to traverse a perfect square with size N from middle of the square and spiral counterclockwise until it reach to the bottommost right
#include <iostream>
using namespace std;
void traverse(int* arr,int N)
{
int i = (N-1)/2;
int j = i;
int steps(1);
int maxSteps = N;
@jenglamlow
jenglamlow / rotate.cpp
Last active June 8, 2017 17:49
Rotate 90 degree clockwise for 2D perfect square array using array with 1D representation
#include <iostream>
#include <cmath>
// From Google Chromium Project
#define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
using namespace std;
void rotate(int *arr, int len)
{
@jenglamlow
jenglamlow / config.py
Last active June 1, 2016 02:53
Create config.yaml when not exist
import sys
import yaml
import os
import getpass
def touch(fname, times=None):
with open(fname, 'a'):
os.utime(fname, times)
def config_init():
@jenglamlow
jenglamlow / cookie_store.py
Last active June 1, 2016 02:46
Cookie Storing