Skip to content

Instantly share code, notes, and snippets.

@adaiguoguo
adaiguoguo / lvmdisk.sh
Last active August 29, 2015 14:22
lvm 分区 需默认安装lvm2 /srv 10g /home 10g /data 10g
umount /dev/vdb1 /data
fdisk -c -u /dev/vdb <<EOF
D
w
EOF
sleep 1s
fdisk -c -u /dev/vdb <<EOF
n
p
1
@adaiguoguo
adaiguoguo / 0_reuse_code.js
Last active August 29, 2015 14:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
reponame = os.environ['GERRIT_PROJECT']
repo = reponame.replace('/','-')
print repo
file=open('sonar-project.properties','w')
s='''sonar.projectKey='''+repo+'''\nsonar.projectName='''+repo+'''\nsonar.projectVersion=1.0\nsonar.sources=.\nsonar.sourceEncoding=UTF-8'''
file.write(s)
file.close()
@adaiguoguo
adaiguoguo / _.md
Last active August 29, 2015 14:17 — forked from klange/_.md

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is written in BSD mandoc.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at
@adaiguoguo
adaiguoguo / close_fds
Last active August 29, 2015 14:14
don't close_fds on Windows
return Popen([sys.executable, '-c', cmd, '--existing', cf] + argv,
- stdout=PIPE, stderr=PIPE, close_fds=True,
+ stdout=PIPE, stderr=PIPE, close_fds=(sys.platform != 'win32'),
)