Skip to content

Instantly share code, notes, and snippets.

@jedy
jedy / tc.sh
Created May 24, 2012 02:35
tc带宽控制
#!/bin/bash
#脚本文件名: tc2
#########################################################################################
#用TC(Traffic Control)解决ADSL宽带速度技术 Ver. 1.0 by KindGeorge 2004.12.27 #
#########################################################################################
#此脚本经过实验通过,更多的信息请参阅http://lartc.org
#tc+iptables+HTB+SFQ
#
#一.什么是ADSL? ADSL(Asymmetric Digital Subscriber Loop,非对称数字用户环路)
#用最简单的话的讲,就是采用上行和下行不对等带宽的基于ATM的技术.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
table {
border-collapse: collapse
}
</style>
<script src="jquery.min.js"></script>
<script>
function add_float_head(tid){
@jedy
jedy / tail_recurse.py
Created June 5, 2012 09:53
python尾递归
# This program shows off a python decorator(
# which implements tail call optimization. It
# does this by throwing an exception if it is
# it's own grandparent, and catching such
# exceptions to recall the stack.
import sys
class TailRecurseException:
def __init__(self, args, kwargs):
@jedy
jedy / ip_addr.py
Created June 5, 2012 09:55
get ip address
import socket
import fcntl
import struct
def get_ip_address(ifname):
"""
>>> get_ip_address('lo')
'127.0.0.1'
>>> get_ip_address('eth0')
@jedy
jedy / Monokai.tmTheme
Created June 25, 2012 12:34 — forked from anateus/Monokai.tmTheme
Monokai for Sublime Text: Markdown supported + some additional element differentiation
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai</string>
<key>settings</key>
<array>
<dict>
@jedy
jedy / ExportHtml.py
Created June 28, 2012 03:49
fix color of exporthtml
import sublime
import sublime_plugin
from os import path
import tempfile
import sys
import datetime
import webbrowser
import re
from HtmlAnnotations import get_annotations
import ExportHtmlLib.desktop as desktop
@jedy
jedy / s.go
Created July 3, 2012 02:56
在golang中传递网络socket
package main
import (
"fmt"
"net"
"os"
"bufio"
)
func main() {
# -*- coding: utf8 -*-
"""
使用java的模块SmartXLS[http://www.smartxls.com/indexj.htm]和jpype修改excel
和xlrd,xlwt不同的是它可以生成和保持图表
"""
from __future__ import print_function, division
import os
@jedy
jedy / reader.go
Created August 7, 2012 07:20
processes communicate with shared memory in golang
package main
// #include <stdlib.h>
// #include "wrapper.c"
import "C"
import "unsafe"
import "fmt"
func read(filename string) string {
f := C.CString(filename)
@jedy
jedy / go_scp.go
Last active May 31, 2022 07:20
an example of scp in golang
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
const privateKey = `content of id_rsa`