Skip to content

Instantly share code, notes, and snippets.

YangLe smilingpoplar

Block or report user

Report or block smilingpoplar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
smilingpoplar / ddns
Created Apr 30, 2019
ddns for dnspod
View ddns
new_ip=${3:-$(curl -s '' | sed 's/.*"ip":"\([0-9.]*\)".*/\1/')}
api_call() {
local param="login_token=${token}&format=json&domain=${domain}&${2}"
curl -s -k -XPOST -o- -A'shdns/0.1(' -d $param${1}
# -*- coding: utf-8 -*-
import unicodedata
""" Normalise (normalize) unicode data in Python to remove umlauts, accents etc. """
data = u'naïve café'
normal = unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore')
print normal
smilingpoplar / string_util.cpp
Last active Oct 7, 2015
string with format
View string_util.cpp
string stringWithFormat(const char *fmt, ...) {
int desiredLength= 1024;
string str;
va_list ap;
while (true) {
va_start(ap, fmt);
int printedLength= vsnprintf((char *)str.c_str(), str.size()+1, fmt, ap);
// '-1' means the buffer was too small.
smilingpoplar / ColourUtils.h
Created May 12, 2012
convert color between RGBA and HSV
View ColourUtils.h
* ColourUtils.h
* Copyright 2012 Stewart Hamilton-Arrandale.
* Modified by Yannick Loriot.
* Permission is hereby granted, free of charge, to any person obtaining a copy
smilingpoplar / gitit.conf
Created Feb 13, 2012
View gitit.conf
server {
listen 80;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
smilingpoplar / .screenrc
Created Feb 6, 2012
View .screenrc
# ~/.screenrc
# kill splash screen
# startup_message off
# replace C-a with C-j
escape ^Jj
# show original screen when exit from emacs/vi
altscreen on
smilingpoplar / gist:1728823
Created Feb 3, 2012
View gist:1728823
import types
for k,v in vars().items():
if k.startswith('test') and isinstance(v, types.FunctionType):
print k, v
View gist:1728818
import time
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
smilingpoplar / DefaultKeyBinding.dict
Created Feb 3, 2012
xcode keybindings for emacs emulation
View DefaultKeyBinding.dict
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
* To use: copy this file to ~/Library/KeyBindings/
* after that any Cocoa applications you launch will inherit these bindings
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
smilingpoplar / ghs.conf
Created Jan 21, 2012
View ghs.conf
upstream ghs {
server {
listen 80;
location / {
proxy_pass http://ghs;
proxy_redirect off;
You can’t perform that action at this time.