Skip to content

Instantly share code, notes, and snippets.

@cirqueit
cirqueit / Flat UI directives.md
Last active August 29, 2015 14:04
FlatUI checkbox, radio and switch w/ AngularJS

##Angular directives for Flat UI

  • checkboxes
  • radio buttons
  • switches

Check the JSFiddle

###Example

@tmc
tmc / gist:776364
Created January 12, 2011 16:12
simple multiprocessing gevent echo server
import sys
from gevent import server
from multiprocessing import Process, current_process, cpu_count
def note(format, *args):
sys.stderr.write('[%s]\t%s\n' % (current_process().name, format%args))
def echo(socket, address):
print 'New connection from %s:%s' % address
@JasperVanDenBosch
JasperVanDenBosch / version.py
Created May 1, 2012 13:02 — forked from dcreager/version.py
Extract a setuptools version from the git repository: adapted for PEP 386
# -*- coding: utf-8 -*-
# Author: Douglas Creager <dcreager@dcreager.net>
# This file is placed into the public domain.
# Calculates the current version number. If possible, this is the
# output of “git describe”, modified to conform to the versioning
# scheme that setuptools uses. If “git describe” returns an error
# (most likely because we're in an unpacked copy of a release tarball,
# rather than in a git working copy), then we fall back on reading the
# contents of the RELEASE-VERSION file.
@bssstudio
bssstudio / TCPServer.scala
Created January 11, 2013 07:41
Dead simple http responder (not even echo test)
//scalaVersion 2.9.2
//akkaVersion 2.0.1
import akka.actor._
import java.net.InetSocketAddress
import akka.util.ByteString
import java.net.Socket
import akka.actor.IO.SocketHandle
import akka.actor.IO._
import akka.routing.RoundRobinRouter
import akka.actor.IO._
import akka.actor.{Props, IO, IOManager, Actor, ActorSystem}
import akka.event.Logging
import akka.util.ByteString
import java.net.InetSocketAddress
class TCPEchoServer(port: Int) extends Actor {
val log = Logging(context.system, this)
val state = IterateeRef.Map.async[IO.Handle]()(context.dispatcher)
@huiyiqun
huiyiqun / macvlan.md
Created November 4, 2015 13:41
读macvlan代码的心得(为了给macvlan添加multicast支持)

Macvlan 内核代码阅读备忘

暂时没有博客,就放到这里了。

Macvlan和Macvtap的关系

Macvtap的代码没有去深读,从代码头上的注释来看,macvtap主要是在macvlan的基础上封装了一个char设备,维护一个队列,因此网络相关的主要逻辑应该在macvlan里。

Macvlan的数据结构里的逻辑关系(主要看macvlan_common_newlink)

+--------------------------------------------------------------------------------------------------------------------------+

@msabramo
msabramo / git_prompt_info.zsh
Created April 11, 2012 00:07
The slowness of my zsh prompt when in a git-svn managed directory was killing me. I improved it by removing the git status stuff that slows it down...
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
@onlytiancai
onlytiancai / python_infrastructure.md
Created October 12, 2012 08:55
python 基础设施讨论贴

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

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

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

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

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

@greensea
greensea / OpenVPN-2.2.2-obfs.patch
Last active March 22, 2023 09:17
The obfs patch obsfucate OpenVPN traffic, make it looks like random traffic. The obfs patch add two options for OpenVPN. --obfs-salt <string> is a secret to generate the input XOR stream. To enable the obfs patch, this options must be set. --obfs-padlen <num> is a positive integer max to 255. This option tells obfs patch to padding random conten…
--- openvpn-2.2.2.orig/options.c 2011-12-14 00:58:56.000000000 +0800
+++ openvpn-2.2.2/options.c 2012-12-21 10:44:57.683130505 +0800
@@ -54,6 +54,10 @@
#include "memdbg.h"
+extern char* _socket_obfs_salt;
+extern int _socket_obfs_salt_len;
+extern int _socket_obfs_padlen;
+