Skip to content

Instantly share code, notes, and snippets.

View chenzhiwei's full-sized avatar

Chen Zhiwei chenzhiwei

View GitHub Profile
@jtyr
jtyr / hostsfile.py
Last active April 25, 2019 10:35
Ansible dynamic inventory script that reads any Ansible hosts file and transforms it into the JSON data structure.
This was moved to https://github.com/jtyr/ansible-ini_inventory
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import org.jenkinsci.plugins.plaincredentials.*
import org.jenkinsci.plugins.plaincredentials.impl.*
import hudson.util.Secret
import hudson.plugins.sshslaves.*
@cyio
cyio / README.md
Last active September 9, 2015 07:43
【用户脚本】为印象笔记网页版添加“插入待办事项”的快捷键

支持在印象笔记中,按快捷键(ctrl-alt-k)插入待办事项

原作者:Jason Stillwell
经由Oaker修改,支持印象笔记。根据本脚本,也可为其它编辑功能绑定快捷键。

@pkuczynski
pkuczynski / parse_yaml.sh
Last active April 9, 2024 18:36
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@ar-lex
ar-lex / Ubuntu.colorscheme
Last active January 9, 2022 09:41
~/.kde/share/apps/konsole/Ubuntu.colorscheme - Ubuntu Color Scheme for Konsole.
[Background]
Color=48,10,36
MaxRandomHue=0
MaxRandomSaturation=0
MaxRandomValue=0
[BackgroundIntense]
Color=89,18,67
[Color0]
@budnik
budnik / gnome-terminal.css
Last active January 26, 2021 03:08
Gnome terminal CSS for ambiance theme
/* gnome-terminal */
TerminalScreen {
-TerminalScreen-background-darkness: 0.95;
background-color: #300a24;
color: #fff;
}
TerminalWindow,
TerminalWindow.background {
background-image: none;
@rashidi
rashidi / android-masking-network-operator.sh
Created October 20, 2011 11:23
Android - Masking Network Operator
# Settings -> Applications -> Manage Applications -> Market -> Clear Cache -> Force Stop (this button will be enabled if your Market is still running) -> OK
# Open a console and type the following command (for *nix user, remember to use sudo to avoid permission error):
adb shell setprop gsm.sim.operator.numeric 310260
adb shell setprop gsm.operator.numeric 310260
adb shell getprop gsm.sim.operator.iso-country us
adb shell getprop gsm.operator.iso-country us
@eroullit
eroullit / gist:1250603
Created September 29, 2011 11:58
git pre-commit indent hook
#!/bin/sh
#
# Hook used to indent all source files before commiting
#
INDENT="$(git config hooks.indent)"
if test ! -x "$INDENT"
then
echo "Unable to find indent executable on the configuration."
echo

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@christian-oudard
christian-oudard / gfm.py
Created June 29, 2010 18:51
Github Flavored Markdown in Python
import re
from hashlib import md5
def gfm(text):
# Extract pre blocks.
extractions = {}
def pre_extraction_callback(matchobj):
digest = md5(matchobj.group(0)).hexdigest()
extractions[digest] = matchobj.group(0)
return "{gfm-extraction-%s}" % digest