Skip to content

Instantly share code, notes, and snippets.

View tyt2y3's full-sized avatar
🦀
Rustacean

Chris Tsang tyt2y3

🦀
Rustacean
View GitHub Profile
@tyt2y3
tyt2y3 / readme.md
Last active November 16, 2018 05:06
Install a perfect Linux box on Chromebook Pixel 2 (samus)
@tyt2y3
tyt2y3 / web.config
Created May 27, 2018 14:10
IIS configuration for Yii2
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="web" enabled="true">
<match url="^(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
@tyt2y3
tyt2y3 / picasa_up.py
Created November 10, 2017 02:09 — forked from kylexlau/picasa_up.py
upload photos to google picasa
#!/usr/bin/python
# upload photos to google picasa
import gdata.photos.service
import getpass
import socket
import glob
import sys
import os
@tyt2y3
tyt2y3 / chatroom.py
Created July 11, 2015 10:00
Simple chatroom in Python, upon BaseHTTPServer and long polling
'''
Simple chatroom
Reference
https://docs.python.org/2/library/threading.html
http://blog.oddbit.com/2013/11/23/long-polling-with-ja/
http://zulko.github.io/blog/2013/09/19/a-basic-example-of-threads-synchronization-in-python/
http://www.laurentluce.com/posts/python-threads-synchronization-locks-rlocks-semaphores-conditions-events-and-queues/
'''
@tyt2y3
tyt2y3 / bezier2.as
Last active December 17, 2015 12:39
the simplest snippet for evaluating quadratic bezier curves. only integer computation is involved.
function bezier2(ax, ay, bx, by, cx, cy) {
var minlength = 20;
var dist = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2)) + Math.sqrt(Math.pow(bx - cx, 2) + Math.pow(by - cy, 2));
var steps = dist / minlength;
moveTo(ax, ay);
for (var i=0; i<steps; i++) {
var x = getstep(getstep(ax, bx, i, steps), getstep(bx, cx, i, steps), i, steps);
var y = getstep(getstep(ay, by, i, steps), getstep(by, cy, i, steps), i, steps);
lineTo(x, y);
}