Skip to content

Instantly share code, notes, and snippets.

@wynemo
wynemo / add_route
Last active February 20, 2023 16:47
openvpn over shadowsocks
# in /etc/sysctl.conf
# net.ipv4.ip_forward=1
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
iptables -A FORWARD -j REJECT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.lib.packet import packet
from ryu.lib.packet import ethernet
class SimpleSwitch13(app_manager.RyuApp):
@windwiny
windwiny / gist:c85dd8c2571b4374f874
Last active October 24, 2023 05:55
Linux 基于策略的路由(Linux Policy Routing)(Linux 多个网卡使用相同网段的IP地址设置)
----
Linux 基于策略的路由(Linux Policy Routing)
Linux 有传统的基于数据包目的地址的路由算法,和新的基于策略的路由算法
新算法优点:支持多个路由表,支持按数据报属性(源地址、目的地址、协议、端口、数据包大小、内容等)选择不同路由表
# 查看规则命令,后面可跟其它参数,默认为 show(list) 显示全部
ip rule
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int heap_elem_t;
typedef struct heap_t
{
int size;
int capacity;
@Embedded-linux
Embedded-linux / Bubble sort in C
Created September 12, 2013 10:02
Bubble sort In C
#include <stdio.h>
int main()
{
int s,temp,i,j,a[20];
printf("Enter total no. of elements:");
scanf("%d",&s);
printf("Enter %d elements:",s);
for(i=0;i<s;i++)
# -*- coding: utf8 -*-
# 下载速度很慢,
import urllib2, urllib
import sys
import os
import socket
import re
import socks

Sublime Text 2 – Useful Shortcuts (Windows)

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command prompt
Ctrl+` python console
Ctrl+N new file

Editing

#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 2
Comment=Edit text files
Exec=/usr/local/sublime-text-2/sublime_text
Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
@dkd903
dkd903 / install-sublime-text.sh
Last active December 16, 2015 14:29
Install Sublime Text 2 editor on Fedora Linux & Red Hat Linux - 32 Bit Edition. More at: http://digitizor.com/?p=15476; Inspired from https://gist.github.com/henriquemoody/3288681
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 2
Comment=Edit text files
Exec=/usr/local/sublime-text-2/sublime_text
Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
@DamienCassou
DamienCassou / update-emacs-ppa.sh
Last active February 20, 2016 21:26
Emacs-snapshot and emacs24 build script for Ubuntu PPA
#! /usr/bin/env bash
# Author: Damien Cassou
#
# This is the script I use to build Emacs packages for Ubuntu. These
# packages are uploaded to
# https://launchpad.net/~cassou/+archive/emacs/. Each package is
# either build from a Debian package or from
# http://emacs.naquadah.org/.