Skip to content

Instantly share code, notes, and snippets.

View leohacker's full-sized avatar

Leo Jiang leohacker

View GitHub Profile
@leohacker
leohacker / PerformanceRelated.txt
Created October 18, 2016 14:01 — forked from neomatrix369/PerformanceRelated.md
Interesting links in the areas of HPC, low latency, mechanical harmony/sympathy, garbage collection
Everything I Ever Learned About JVM Performance Tuning @Twitter- by Attila Szegedi
http://www.infoq.com/presentations/JVM-Performance-Tuning-twitter (video & slides)
9 Fallacies of Java Performance - by Ben Evans
http://www.infoq.com/articles/9_Fallacies_Java_Performance (video & slides)
Visualizing Java GC - by Ben Evans
http://www.infoq.com/presentations/Visualizing-Java-GC (video & slides)
@leohacker
leohacker / ABS_Snippet.md
Last active July 20, 2016 16:19
Bash Snippet

Advanced Bash Scripting Guide

Code snippet from ABS.

# initialization file (not found)
@leohacker
leohacker / gist:e701ff3d00c0e52035bbed96d86af1f7
Created June 12, 2016 05:51
Indirect reference in bash ( check a variable if its value as variable is set )
# varname=USER or PROFILE_PATH
# $varname == USER
# $$ pid of current process
# \$$varname == $USER in literal
# eval variable=..... evaluate and assign to variable
eval variable=\$$varname
@leohacker
leohacker / AFHTTPRequestOperationManager2.m
Last active August 29, 2015 14:16
AFNetworking Official Code Snippets
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *parameters = @{@"foo": @"bar"};
[manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
@leohacker
leohacker / AFNetworking
Last active August 29, 2015 14:14
AFNetworking Snippets
list AFNetworking Snippets here.
@leohacker
leohacker / gist:e9b7adf66370cb9fae50
Last active August 29, 2015 14:14 — forked from fgarcia/gist:3968236
Podfile Sample
# vim:ft=Ruby
#
# Base Podfile template for projects targeting OSX and iOS
#
# Author: Francisco Garcia <[email protected]>
# https://github.com/fgarcia
#
# Last Update: 2012-11-28
@leohacker
leohacker / OC_sqlite3_open.m
Last active August 29, 2015 14:14
Find the path for resource, open the sqlite3 database.
- (id)init {
if ((self = [super init])) {
NSString *sqLiteDb = [[NSBundle mainBundle] pathForResource:@"banklist"
ofType:@"sqlite3"];
if (sqlite3_open([sqLiteDb UTF8String], &_database) != SQLITE_OK) {
NSLog(@"Failed to open database!");
}
}
return self;
@leohacker
leohacker / 1_ruby_quicksort.rb
Last active August 29, 2015 14:14
Here are some things you can do with Gists in GistBox.
# Use Gists to store entire functions
class QuickSort
def self.sort!(keys)
quick(keys,0,keys.size-1)
end
private
def self.quick(keys, left, right)