Skip to content

Instantly share code, notes, and snippets.

View yongjhih's full-sized avatar
🏠
Working from home

Andrew Chen yongjhih

🏠
Working from home
View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@kennethreitz
kennethreitz / 0_urllib2.py
Created May 16, 2011 00:17
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@fcamel
fcamel / sleep_sort.py
Created June 23, 2011 16:09
Sleep Sort: an amazing sorting algorithm!!
#!/usr/bin/env python2.6
# -*- encoding: utf8 -*-
'''
An advanced version of Sleep Sort.
The original idea is from: http://coolshell.cn/articles/4883.html
Use the concept of radix sort to speed it up.
The newer version references WanCW's implementation in Ruby:
@lethargicpanda
lethargicpanda / OAuthActivity.java
Created December 25, 2011 23:48
OAuthActivity implements OAuth logg in in your Android application
public class OAuthActivity extends Activity {
public static String OAUTH_URL = "https://github.com/login/oauth/authorize";
public static String OAUTH_ACCESS_TOKEN_URL = "https://github.com/login/oauth/access_token";
public static String CLIENT_ID = "YOUR_CLIENT_ID";
public static String CLIENT_SECRET = "YOUR_CLIENT_SECRET";
public static String CALLBACK_URL = "http://localhost";
@Override
@epegzz
epegzz / Monaco_Linux-Powerline.ttf
Created January 18, 2012 17:19
Monaco for vim-powerline
@baopham
baopham / Monaco for Powerline.otf
Last active April 16, 2023 03:57
Patched font Monaco for OSX Vim-Powerline
@eskil
eskil / m2crypto-certificates.py
Created April 8, 2012 17:07
Example of generating CA certs and CA signed certs using python m2crypto.
"""
Tools for creating a CA cert and signed server certs.
Divined from http://svn.osafoundation.org/m2crypto/trunk/tests/test_x509.py
The mk_temporary_xxx calls return a NamedTemporaryFile with certs.
Usage ;
# Create a temporary CA cert and it's private key
cacert, cakey = mk_temporary_cacert()
@fluxtah
fluxtah / Example.java
Created April 30, 2012 15:26
A fluent android sqlite selection query builder useful for constructing content provider selections with arguments
SelectionQueryBuilder q = new SelectionQueryBuilder()
.expr("is_awesome", EQ, true)
.expr("money", GT, 50.0f)
.expr("speed", LT, 21.1f)
.or()
.expr("door_number", EQ, 123)
.or().expr(
new SelectionQueryBuilder()
.expr("a", GT, 0)
.expr("a", LT, 100)
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

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 > 1000)
@toolness
toolness / gencert.py
Last active June 22, 2023 11:52
Python script to create server SSL certs and sign them with a custom CA.
#! /usr/bin/python
"""
This simple script makes it easy to create server certificates
that are signed by your own Certificate Authority.
Mostly, this script just automates the workflow explained
in http://www.tc.umn.edu/~brams006/selfsign.html.
Before using this script, you'll need to create a private