Skip to content

Instantly share code, notes, and snippets.

View zyan0's full-sized avatar
🎯
Focusing

Zheng Yan zyan0

🎯
Focusing
View GitHub Profile
import StringIO
import time
import pycurl
import stem.control
from stem.util import term
import stem.process
# Static exit for us to make 2-hop circuits through. Picking aurora, a
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
#!/bin/bash
SCRIPT=substitute.sh
for f in *
do
if [ $f = $SCRIPT ]
then
echo "skip $f"
continue
@zyan0
zyan0 / run.sh
Created November 15, 2013 06:48
while true; do
sh mine.sh
sleep 10
done
void main() {
auto f = File("name.bin", "wb");
string raw = "hai";
f.write(raw);
}
@zyan0
zyan0 / cube.c
Created June 14, 2013 04:09
Cubing Numbers Using CUDA
#include <stdio.h>
__global__ void cube(float * d_out, float * d_in){
int idx = threadIdx.x;
float f = d_in[idx];
d_out[idx] = f * f * f;
}
int main(int argc, char ** argv) {
const int ARRAY_SIZE = 64;
#!/usr/bin/env python
# -*- coding: utf-8 -*-
stu_id = 'your student id'
username = password = 'use your own credential, hint: 00xxxxx'
host = '10.14.101.169'
login_url = 'http://10.14.101.169/LogOn'
lab_url ='http://10.14.101.169/TA/lab/Edit/114'
check_url = 'http://10.14.101.169/QianDao'
#!/usr/bin/python
# - * - coding: UTF-8 - * -
# Copyright (C) 2010 Upsuper <quanxunzhen@gmail.com>
# License: AGPLv3
from threading import Thread, Lock
from httplib import HTTPConnection
import urllib
import cgi, json
@zyan0
zyan0 / hello.rb
Created December 1, 2012 02:25
Hello,world! for RPG Maker XP
class Window_Hello < Window_Base
def initialize
super(380 , 20, 220, 60)
self.contents = Bitmap.new(width - 32, height - 32)
@time = 0
end
def update
if @time == 0
self.contents.clear