Skip to content

Instantly share code, notes, and snippets.

View mactanxin's full-sized avatar
😆
happy coding

Xin Tan mactanxin

😆
happy coding
  • San Jose
  • 20:51 (UTC +08:00)
View GitHub Profile
@mactanxin
mactanxin / dabblet.css
Created February 20, 2013 09:56
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: linear-gradient(45deg, #f06, gold);
background: border-radius(10px);
/*background-image:url("http://images.apple.com/macosx/mountain-lion/images/overview_mountainlion.png");*/
/*min-height:100%;*/
@mactanxin
mactanxin / create_random_passwd.py
Created March 11, 2013 09:50
create random passed with python
import os, random, string
length = 16
chars = string.ascii_letters + string.digits + '!@#$%^&*()'
random.seed = (os.urandom(1024))
print ''.join(random.choice(chars) for i in xrange(length))
#!/bin/sh
# LoopBomb.sh
# SliderLab
#
# Created by tanxin on 4/2/13.
#
tell application "Messages"
set theBuddy to buddy "[email protected]"
def fib_recursion(n):
if n >= 0 and n < 2:
return 1
else:
return fib_recursion(n-1)+fib_recursion(n-2)
def fib():
x, y = 0,1
while True:
yield x
#!/bin/sh
#
# MongoDB OSX Launch Item
#
# usage: sudo ./install.sh
#
# initialize
DAEMON_PATH=`which mongod`
@mactanxin
mactanxin / read_usage
Created September 16, 2014 05:39
learn how to use read
#!/bin/bash
while true;do
read -p "Enter an integer:" num搜索
if [ $num -eq 100 ];then
break
fi
done
exit 0
#!/bin/sh
# (POSIX shell syntax)
# Reset all variables that might be set
file=
verbose=0
while :; do
case $1 in
-h|-\?|--help) # Call a "show_help" function to display a synopsis, then exit.
class Solution(object):
def reverse(self, x):
signal = 1 if x > 0 else -1
x = abs(x)
if x > 0:
x = "".join(list(str(x))[::-1])
if 2 ** 31 -1 >= signal * int(x) >= -2 ** 31 +1:
return signal * int(x)
else:
return 0
@mactanxin
mactanxin / dabblet.css
Created February 18, 2016 05:15
Untitled
body { padding-bottom: 40px; padding-top: 55px;}.sidebar-nav-fixed { width:13%;}
body { padding-bottom: 40px; padding-top: 55px;}.sidebar-nav-fixed { width:13%;}