Skip to content

Instantly share code, notes, and snippets.

View zlargon's full-sized avatar
:electron:
Focusing

Leon Huang zlargon

:electron:
Focusing
  • Boston, MA
View GitHub Profile
@zlargon
zlargon / week2_recap.md
Last active November 10, 2018 09:12
The Week2 Recap Note for ITC6355
@zlargon
zlargon / example1.py
Last active September 20, 2018 03:01
python break and continue
# example 1: print 1 2 3 4 5
i = 1
while i < 6:
print(i)
i += 1
@zlargon
zlargon / reg.py
Last active April 20, 2018 06:51
'adsfdsa[aa] sadfbdsaf[bb], [cc]' => [aa, bb, cc]
# 'adsfdsa[aa] sadfbdsaf[bb], [cc]' => [aa, bb, cc]
import re
str = 'adsfdsa[aa] sadfbdsaf[bb], [cc]'
list = re.findall("\[\w+\]", str) # ['[aa]', '[bb]', '[cc]']
list = map(lambda x: x[1:-1], list) # ['aa', 'bb', 'cc']
print(list)
@zlargon
zlargon / karabiner_backslash_to_forward_delete.json
Last active April 12, 2018 17:01
Backslash to Forward Delete: 1. Fn+Backslash to Backslash 2. retain Shift+Backslash
{
"title": "Backslash to Forward Delete",
"rules": [
{
"description": "1. Fn+Backslash to Backslash 2. retain Shift+Backslash",
"manipulators": [
{
"from": {
"key_code": "backslash",
"modifiers": {
#include <stdio.h>
#include <stdlib.h>
// Number
typedef struct {
int value;
} Number;
Number new (int value);
void add (Number * ctx, int value);
@zlargon
zlargon / private.xml
Created February 5, 2017 02:54
[Karabiner] Swap Semicolon and Shift_R
<?xml version="1.0"?>
<root>
<item>
<name>Swap Semicolon and Shift_R</name>
<identifier>private.swap_semicolon_shift_R</identifier>
<autogen>__KeyToKey__ KeyCode::SEMICOLON, KeyCode::SHIFT_R</autogen>
<autogen>__KeyToKey__ KeyCode::SHIFT_R, KeyCode::SEMICOLON</autogen>
</item>
</root>
@zlargon
zlargon / speed_up_mp3.md
Last active April 15, 2020 00:43
Speed up mp3 file by FFmpeg on Mac
@zlargon
zlargon / sizeof.c
Created January 24, 2017 15:13
implement "sizeof"
#include <stdio.h>
typedef struct {
int i;
char a;
char b[3];
float * c;
char s[100];
} T;
@zlargon
zlargon / Example.c
Last active December 21, 2016 17:51
An example of exception in C and Java
#include <stdio.h>
// int add (int a, int b) {
// return a + b;
// }
/*
* @param {int} sum
* @param {int} a
* @param {int} b
public static Tree<T> BFS<T>(Tree<T> root, int target) {
// create Queue, and enqueue root node
Queue<Tree<T>> queue = new Queue<Tree<T>>();
queue.Enqueue(root);
while (queue.Count > 0) {
// dequeue first node
Tree<T> node = queue.Dequeue();
// compare target