Skip to content

Instantly share code, notes, and snippets.

# readRecordNew.tcl
# -----------------------------------------------------------------------------
#
# Written by: fmk
# Date: July, 2010
#
# Modified by: wnduan (mostly based on fmk version)
# Date: Apr 25, 2018
#
# Description:
@wnduan
wnduan / color-line.py
Created April 18, 2018 23:35
use matploblib to draw a line of variable color
#!/usr/bin/env python
# ~/Nutstore/matplotlib-notes/notebook/09
#
# version: 0.1
import numpy as np
from matplotlib import colors, cm
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(5,3))
@wnduan
wnduan / sizes.c
Last active April 17, 2018 19:48
List sizes of different data types in C.
/* This script will list sizes of different types of data on a certain platform. */
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <float.h>
int main(void) {
printf("SIZEOF char : %2lu / %3lu\n",
% CTeX with XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.
%!TEX TS=program = xelatex
%!TEX encoding = UTF=8 Unicode
\documentclass[UTF8, no=math]{ctexart}
\usepackage[a4paper]{geometry}
\geometry{left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm}
@wnduan
wnduan / hyperbolid-one-lines.asy
Last active November 13, 2017 11:23
Asymptote 3D: hyperbolid of one sheet
// Asymptote 3D graph
// Draw lines (NOT surface) to show a hyperbolid of one sheet
// use very basic functions to draw a simple one.
// by: wnduan
settings.outformat="png";
settings.render=16;
//import solids;
import three;
size(12cm,0);
@wnduan
wnduan / basic-example.tex
Last active November 11, 2017 20:01
biblatex-gb7714-2015 基本使用方法/ Basics
\usepackage[%
backend=biber,
style=gb7714-2015ay, % author-year style
% style=gb7714-2015, % numerical style
% `align` only works with numerical sytle: `style=gb7714-215`,
% avilable values include: right, left, gb7714-2015, default value: right
% align=left,
gbpub=true,
gbnoauthor=false
]{biblatex}
@wnduan
wnduan / hyperbolic-parabolid-3d.asy
Last active November 9, 2017 06:14
Asymptote 3D: draw a hyperbolic parabolid surface
// Asymptote 3D graph
// Draw a hyperbolic paraboloid
// use very basic functions to draw a simple one.
// by: wnduan
settings.outformat="png";
settings.render=16;
import three;
import graph3;
size(12cm,0);
@wnduan
wnduan / animation1.py
Last active November 7, 2017 11:48
A matplotlib Example: some animation
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def data_gen(t=0):
cnt = 0
while cnt < 5000:
cnt += 1
t += .02
@wnduan
wnduan / v2ex_308543.py
Last active September 25, 2016 22:45
A python problem from v2ex: https://www.v2ex.com/t/308543#;
# -*- coding: utf-8 -*-
t1 = [{'id':1, 'abc':'2'}, {'id':1, 'abc':'3'}, {'id':2, 'abc':'2'}]
t2 = []
ids = []
# Get all id values
for item in t1:
ids.append(item['id'])
ids = sorted(list(set(ids)))
@wnduan
wnduan / en.conf.ini
Last active April 17, 2018 19:52 — forked from Blankwonder/en.conf.ini
surge official config file v2.0
# You can download this config from: http://surge.run/config-example/ios.conf
# Edit with your computer and copy back to iOS device via iTunes, URL, AirDrop
# or iCloud Drive
# Version 2.0
[General]
# Log level: warning, notify, info, verbose (Default: notify)
loglevel = notify
# Skip domain or IP range. These hosts will not be processed by Surge Proxy.
# (In macOS version when Set as System Proxy enabled, these hosts will be