Skip to content

Instantly share code, notes, and snippets.

View tianweidut's full-sized avatar
🎯
Focusing

tianwei tianweidut

🎯
Focusing
View GitHub Profile
@jasonzhouu
jasonzhouu / chinese_input_in_manjaro.md
Last active August 16, 2024 06:42
Config Chinese input method in Manjaro(Manjaro 配置中文输入法)

1. install packages

run:

yay -Syu adobe-source-han-sans-otc-fonts adobe-source-han-serif-otc-fonts 
yay -Syu fcitx fcitx-googlepinyin fcitx-im fcitx-configtool 

2. config environmental variables

sudo vim /etc/profile
@zjhiphop
zjhiphop / 分布式系统学习资料.md
Created July 23, 2015 06:13
分布式系统学习资料

##分布式系统(Distributed System)资料


#####希望转载的朋友,你可以不用联系我.但是一定要保留原文链接,因为这个项目还在继续也在不定期更新.希望看到文章的朋友能够学到更多.

介绍:这是一篇介绍在动态网络里面实现分布式系统重构的paper.论文的作者(导师)是MIT读博的时候是做分布式系统的研究的,现在在NUS带学生,不仅仅是分布式系统,还有无线网络.如果感兴趣可以去他的主页了解.

@bradrydzewski
bradrydzewski / generate_docker_cert.sh
Last active May 27, 2024 15:59
Generate trusted CA certificates for running Docker with HTTPS
#!/bin/bash
#
# Generates client and server certificates used to enable HTTPS
# remote authentication to a Docker daemon.
#
# See http://docs.docker.com/articles/https/
#
# To start the Docker Daemon:
#
# sudo docker -d \
@ageron
ageron / nth_percentile.py
Created March 21, 2013 11:38
Explanation of 90th percentile
def nth_percentile(dataset, percentile = 90):
sorted_dataset = sorted(dataset)
new_length = len(sorted_dataset) * percentile / 100
return sorted_dataset[0:new_length]
def mean(dataset):
return sum(dataset)/float(len(dataset))
dataset = [5, 9, 7, 101, 4, 8, 109, 104, 6, 1, 110, 106, 3, 107, 105, 2, 102, 10, 103, 108]
percentile_90 = nth_percentile(dataset)
@onlytiancai
onlytiancai / python_infrastructure.md
Created October 12, 2012 08:55
python 基础设施讨论贴

python项目通用组件和基础服务

很多公司都大量使用了python,其中有一些开发规范,code guidline, 通用组件,基础框架是可以共用的。

每个公司都自己搞一套, 太浪费人力,我想开一帖和大家讨论一下这些python基础设施的搭建。

原则是我们尽量不重新发明轮子,但开源组件这么多,也要有个挑选的过程和组合使用的过程,在这里讨论一下。

另一方面,有些开源组件虽然强大,但我们不能完全的驾驭它,或只使用其中很少的一部分,我们就可以考虑用python实现一个简单的轮子,可控性更强,最好不要超过300行代码。

@wweic
wweic / code_contest_template.cpp
Created October 9, 2012 07:34
Code template for programming contest
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
@hrldcpr
hrldcpr / tree.md
Last active September 1, 2024 07:04
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

Django-celery + Redis notes

Installation and Setup

  1. Install redis on OSX (10.7) Lion I used:

     $ brew install redis
    
  2. In the project and virtualenv I wanted to use django-celery in I installed the following.

@gsakkis
gsakkis / gist:866301
Created March 11, 2011 18:10
Dumbo remote debugging
import os, sys
class Winpdb(object):
'''Embed a Winpdb server.
If you have to tunnel to connect remotely from the Winpdb client, run:
ssh -C -N -f -L 51000:localhost:51000 $SERVER_HOST