This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use .ssh/config file to connect to github | |
Preparations: | |
You'd better have prepared following materials: | |
* A pair of public/private keys, say id_rsa_gitlover & id_rsa_gitlover.pub | |
If you don't have yet, here's the instruction you can refer to: | |
https://help.github.com/articles/generating-ssh-keys | |
* A github account, say [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pass arguments in django template | |
<form action="{% url 'polls:vote' question.id %}" method="post"> | |
How does url receives arguments in the template? | |
https://docs.djangoproject.com/en/dev/intro/tutorial03/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
polls/templates/polls/detail.html | |
<h1>{{ question.question_text }}</h1> | |
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} | |
<form action="{% url 'polls:vote' question.id %}" method="post"> | |
{% csrf_token %} | |
{% for choice in question.choice_set.all %} | |
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
curl ipecho.net/plain ; echo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openvpn configure notes: | |
Follow the process on debian wiki: https://wiki.debian.org/OpenVPN | |
The process is almost OK. Only a few adjustments is required as below: | |
checking: | |
$ which openvpn | |
The default directory after installation is: /etc/openvpn/ | |
All relative path in .conf files points to this path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anypackage/ | |
__init__.py | |
xxx.py # class WWW is originally defined in this xxx file. | |
generally speaking, python can only import class from modules, which is usually a .py file. | |
import WWW from xxx | |
But, we can also import class from a package(folder) directly, rather than from the module. This is where an __init__.py file can step onto the stage. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get python dependency graph | |
install snake food | |
sudo apt-get install snakefood | |
http://furius.ca/snakefood/ | |
install graphviz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# grep letters|whitespace|number | |
# http://www.robelle.com/smugbook/regexpr.html | |
ps -elf | grep '[a-zA-Z]\{1,\}\s*2502' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Demo code. Decode base64 content from a string or a readable file | |
# Works for Python 2.7.3, at least | |
# Usage | |
# decodebase64.py base64string | |
# decodebase64.py /absolute/path/to/base64/file | |
import sys |