Skip to content

Instantly share code, notes, and snippets.

View rainbowbird's full-sized avatar
:octocat:
exercising

diankuzh rainbowbird

:octocat:
exercising
View GitHub Profile
@rainbowbird
rainbowbird / Multiple_Rules_for_One_Target.md
Last active May 10, 2018 20:26
dribs and drabs for makefile knowledge

An extra rule with just prerequisites can be used to give a few extra prerequisites to many files at once. For example, makefiles often have a variable, such as objects, containing a list of all the compiler output files in the system being made. An easy way to say that all of them must be recompiled if config.h changes is to write the following:

objects = foo.o bar.o
foo.o : defs.h
bar.o : defs.h test.h
$(objects) : config.h

This could be inserted or taken out without changing the rules that really specify how to make the object files, making it a convenient form to use if you wish to add the additional prerequisite intermittently.

Another wrinkle is that the additional prerequisites could be specified with a variable that you set with a command line argument to make

@rainbowbird
rainbowbird / QEMU
Created October 8, 2016 04:33
QEMU emulator
1. KVM and QEMU
@rainbowbird
rainbowbird / 0_reuse_code.js
Created October 9, 2016 13:47
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
@rainbowbird
rainbowbird / .tmux.conf
Last active October 13, 2016 00:58
tmux
#
# http://mingxinglai.com/cn/2012/09/tmux/
#
# author : Xu Xiaodong <[email protected]>
# modified : 2012 Jul 22
#
#-- base settings --#
set -g default-terminal "screen-256color"
set -g display-time 3000
@rainbowbird
rainbowbird / anonymous_here_document.md
Last active December 9, 2016 02:11
A script that generates antother scriptFrom http://tldp.org/LDP/abs/html/here-docs.html

It is possible to use : as a dummy command accepting output from a here document.
This, in effect, creates an "anonymous" here document.

#!/bin/bash

: <<TESTVARIABLES
${HOSTNAME?}${USER?}${MAIL?}  # Print error message if one of the variables not set.
TESTVARIABLES
#!/usr/bin/env python
"""
Fix trailing whitespace and line endings (to Unix) in a file.
Usage: python fix_whitespace.py foo.py
"""
import os
import sys
# http://stackoverflow.com/questions/28721699/root-password-inside-a-docker-container
1. docker run --security-opt seccomp:unconfined
2. docker exec -u 0 -it <container_id> bash
needs the container is up and running at the moment when you type the above commad
@rainbowbird
rainbowbird / vim8.x_with_lua
Last active May 21, 2017 12:20 — forked from techgaun/vim8.x_with_lua
Install vim with lua support on ubuntu 16.04
I needed to install vim with lua support because I wanted to use neocomplete in my recently installed 15.04 distro. Also, this has python3 enabled by default.
Tested on 16.04 now
Update: This has been tested and verified to work on Ubuntu 16.04 as well. Also, if you wish to use particular branch/tag, you can get the version and then checkout appropriately.
The following (based upon https://gist.github.com/jdewit/9818870) should work though I copied it from history:
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get build-dep vim-gnome
sudo apt-get install build-essential liblua5.3-0 liblua5.3-dev python-dev ruby-dev libperl-dev libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev cscope
@rainbowbird
rainbowbird / autopac.sh
Created February 22, 2018 06:03 — forked from lwr/autopac.sh
使用 https://github.com/clowwindy/gfwlist2pac 生成自定义 PAC 的辅助脚本
#!/bin/bash
GFWLIST=https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt
PROXY=127.0.0.1:7070
cd `dirname "${BASH_SOURCE[0]}"`
echo "Downloading gfwlist from $GFWLIST"
curl "$GFWLIST" --socks5-hostname "$PROXY" > /tmp/gfwlist.txt
/usr/local/bin/gfwlist2pac \
--input /tmp/gfwlist.txt \
@rainbowbird
rainbowbird / python_custom_openssl.diff
Created February 28, 2018 03:47 — forked from eddy-geek/ python_custom_openssl.diff
Compile python with statically linked openssl
--- a/setup.py 2014-03-17 03:31:31.000000000 +0100
+++ b/setup.py 2014-03-17 19:06:03.000000000 +0100
@@ -750,10 +750,8 @@
exts.append( Extension('_socket', ['socketmodule.c'],
depends = ['socketmodule.h']) )
# Detect SSL support for the socket module (via _ssl)
- search_for_ssl_incs_in = [
- '/usr/local/ssl/include',
- '/usr/contrib/ssl/include/'
- ]