Skip to content

Instantly share code, notes, and snippets.

View finlay-liu's full-sized avatar

Yuzhong Liu finlay-liu

View GitHub Profile
@dehowell
dehowell / gist:884204
Created March 23, 2011 22:49
Python function to test if a file at a URL exists.
import urllib2
def file_exists(location):
request = urllib2.Request(location)
request.get_method = lambda : 'HEAD'
try:
response = urllib2.urlopen(request)
return True
except urllib2.HTTPError:
return False
@methane
methane / gist:2185380
Created March 24, 2012 17:28
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):
@debasishg
debasishg / gist:8172796
Last active July 5, 2024 11:53
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@coffeant
coffeant / gist:f9423821ea6c32ed76f8
Created June 3, 2015 01:55
ubuntu modify date timezone to china shanghai
sudo tzconfig,如果命令不存在请使用 dpkg-reconfigure tzdata
然后按照提示选择 Asia对应的序号,选完后会显示一堆新的提示—输入城市名,如Shanghai或Chongqing,最后再用 sudo date -s “” 来修改本地时间
sudo cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime 防止系统重启后时区改变
sudo apt-get install ntpdate
设置系统时间与网络时间同步 ntpdate cn.pool.ntp.org
将系统时间写入硬件时间 hwclock -w :systohc
@jeasinema
jeasinema / weight_init.py
Last active May 25, 2023 09:32
A simple script for parameter initialization for PyTorch
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
import torch
import torch.nn as nn
import torch.nn.init as init
def weight_init(m):
'''