Skip to content

Instantly share code, notes, and snippets.

View liuyix's full-sized avatar

Yi Liu liuyix

View GitHub Profile
@marcusti
marcusti / wuala-git.sh
Created September 9, 2012 07:49
working with a private git repo in Wuala
# create a new bare git repository
cd ~/WualaDrive/username/repos
mkdir project.git
cd project.git
git init --bare
# clone
cd ~/src
git clone ~/WualaDrive/username/repos/project.git/
cd project.git
@podhmo
podhmo / sqlalchemy_example.py
Created December 20, 2012 14:59
sqlalchemy query example.
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import scoped_session, sessionmaker
DBSession = scoped_session(sessionmaker())
class BaseMixin(object):
query = DBSession.query_property()
id = sa.Column(sa.Integer, primary_key=True)
@kennyz
kennyz / kongwu_pi_tips.md
Last active December 25, 2021 12:41
kongwu pi tips

折腾Pi,解决疑难杂症最好还是去官网论坛

image http://www.raspberrypi.org/phpBB3/

支持Apple TimeMachine,实现Mac备份

在磁盘中创建备份目录 mkdir /media/usbdisk/mactimebak 推荐使用ext4分区(打开notime)

安装nettalk

@ppmotskula
ppmotskula / remote-unlock-ubuntu-fde.sh
Created April 2, 2013 19:54
Enable remote unlocking of a fully encrypted (dm-crypt/LUKS) Ubuntu 12.10 server via SSH.
#!/bin/bash
cat << ENDMSG
This script enables you to remotely unlock a fully encrypted (dm-crypt/LUKS) Ubuntu 12.10 server via SSH.
The script must be run as root (via sudo).
Contains bits gratefully taken from
http://hacksr.blogspot.com/2012/05/ssh-unlock-with-fully-encrypted-ubuntu.html and
http://blog.nguyenvq.com/2011/09/13/remote-unlocking-luks-encrypted-lvm-using-dropbear-ssh-in-ubuntu/
@liuyix
liuyix / 0.python_tips_index.md
Last active December 15, 2015 17:59
Python学习备忘

#Python Tips

调用外部命令

detect function type

read large file

@mrchief
mrchief / LICENSE.md
Last active May 20, 2025 13:10
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@liuyix
liuyix / shell-script-dir.sh
Last active December 22, 2015 06:39
shell script: 返回当前script所在路径,即使是symlink也可以。
#!/bin/bash
# http://stackoverflow.com/a/422123
# http://stackoverflow.com/questions/242538/unix-shell-script-find-out-which-directory-the-script-file-resides
dir=$(dirname $(readlink -f "$BASH_SOURCE"))
@davidcrawford
davidcrawford / unzip.py
Created October 1, 2013 06:16
Python UnzipStream — A file-like wrapper around a gzipped stream that uncompresses as it reads.
import os
import zlib
from StringIO import StringIO
ESTIMATED_COMPRESSION_FACTOR = 2
class UnzipStream(object):
'''
@panzi
panzi / mandelbrot.c
Created November 10, 2013 04:40
gcc -lm -Wall -Werror -Wextra -pedantic -std=c99 -O3 -o mandelbrot mandelbrot.c original: http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python/
#include <stdio.h>
#include <complex.h>
#define dc double complex
dc
Y(dc
V,
dc B,dc c){
return
(cabs (V)<6)?(c?Y(V *V+
B,B,c-1):c):(2+c-4*cpow
@liuyix
liuyix / python-tips.md
Last active December 30, 2015 16:09
python best practise!