Skip to content

Instantly share code, notes, and snippets.

View atupal's full-sized avatar

kangle yu atupal

View GitHub Profile
@atupal
atupal / arch-linux-install
Created February 26, 2017 15:14 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@atupal
atupal / bar.py
Last active August 29, 2015 14:21 — forked from DasIch/bar.py
from nonlocal_ import nonlocal_
def foo():
a = 1
def bar():
nonlocal_('a')
a = 2
bar()
return a
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
get proxy list from http://pachong.com
"""
from bs4 import BeautifulSoup
import requests
import gevent
from gevent import monkey, queue
monkey.patch_all()
import urllib2
from time import sleep
import traceback
import logging
import gevent
from gevent import monkey, queue
monkey.patch_all()
import urllib2
from time import sleep
import traceback
import logging
from gcrawler import GCrawler, Downloader
import unittest
import urllib2
import logging
import traceback
from datetime import datetime
import re
logging.basicConfig(level=logging.DEBUG)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple async crawler/callback queue based on gevent."""
import traceback
import logging
import httplib2
import gevent
@atupal
atupal / tree.md
Created May 7, 2014 16:06 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@atupal
atupal / code.js
Created March 31, 2014 10:16 — forked from tcr/code.js
function JSON_stringify(s, emit_unicode)
{
var json = JSON.stringify(s);
return emit_unicode ? json : json.replace(/[\u007f-\uffff]/g,
function(c) {
return '\\u'+('0000'+c.charCodeAt(0).toString(16)).slice(-4);
}
);
}