Skip to content

Instantly share code, notes, and snippets.

View linychuo's full-sized avatar

YC linychuo

View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 20, 2025 21:04
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@EmilHernvall
EmilHernvall / data2sound.py
Created September 29, 2011 14:07
Encode data as sound, and retrieve it using a FFT
class GlobalFormat(object):
def __init__(self):
self.id = 0x46464952 # RIFF
self.size = 0
self.type = 0x45564157 # WAVE
def as_bin(self):
return struct.pack("III", self.id, self.size, self.type)
@sobstel
sobstel / regex_look_ahead_and_behind.rb
Created June 23, 2011 14:51
Regex look ahead and look behind
# (?=) Positive look ahead assertion foo(?=bar) matches foo when followed by bar.
"Best player ever is Leo Messi.".match(/Leo(?=\s?Messi)\s\w+/)
=> ["Leo Messi"]
# (?!) Negative look ahead assertion foo(?!bar) matches foo when not followed by bar.
> "Or maybe Javier Mascherano? Or Javier Zanetti?.".scan(/Javier(?!\s?Mascherano)\s\w+/)
=> ["Javier Zanetti"]
# (?<=) Positive look behind assertion (?<=foo)bar matches bar when preceded by foo.
"Some say it is Sergio Aguero, but Sergio Batista does not let him play much".scan(/\w+\s(?<=Sergio\s)\w+/)
@jpurcell
jpurcell / pull-to-refresh(android).js
Created April 5, 2011 15:58
Tweetie-like pull to refresh and pull to load more. Note that it requries set heights for everything.
// This is the Android version of the Tweetie-like pull to refresh table:
// http://developer.appcelerator.com/blog/2010/05/how-to-create-a-tweetie-like-pull-to-refresh-table.html
var win = Ti.UI.currentWindow;
var alertDialog = Titanium.UI.createAlertDialog({
title: 'System Message',
buttonNames: ['OK']
});
var scrollView = Ti.UI.createScrollView({
@alf239
alf239 / HSQL.java
Created February 3, 2011 18:53
Aggregare function for HSQL to emulate Oracle's WM_CONCAT
@SuppressWarnings("unused")
public static String wmConcat(String in, Boolean flag,
String[] register, Integer[] counter) {
if (flag) {
if (register[0] == null) {
return null;
}
return register[0];
}
if (in == null) {