Skip to content

Instantly share code, notes, and snippets.

Avatar
🐳
On vacation

jamiesun jamiesun

🐳
On vacation
View GitHub Profile
View zclist.rsc
/ip route rule remove [find comment~"CNIP"]
/ip route rule {
add dst-address=1.0.1.0/24 src-address=10.79.0.0/24 table=main comment=CNIP;
add dst-address=1.0.2.0/23 src-address=10.79.0.0/24 table=main comment=CNIP;
add dst-address=1.0.8.0/21 src-address=10.79.0.0/24 table=main comment=CNIP;
add dst-address=1.0.32.0/19 src-address=10.79.0.0/24 table=main comment=CNIP;
add dst-address=1.1.0.0/24 src-address=10.79.0.0/24 table=main comment=CNIP;
add dst-address=1.1.2.0/23 src-address=10.79.0.0/24 table=main comment=CNIP;
add dst-address=1.1.4.0/22 src-address=10.79.0.0/24 table=main comment=CNIP;
add dst-address=1.1.8.0/21 src-address=10.79.0.0/24 table=main comment=CNIP;
@jamiesun
jamiesun / log_test11.py
Created Apr 1, 2018 — forked from anonymous/log_test11.py
Test script showing usage of a buffering SMTP handler.
View log_test11.py
#!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of Vinay Sajip
# not be used in advertising or publicity pertaining to distribution
@jamiesun
jamiesun / rsa_aes.py
Created Dec 18, 2016 — forked from ficapy/rsa_aes.py
pycrypto使用AES/RSA加解密
View rsa_aes.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA
from Crypto import Random
from Crypto.Cipher import AES
aes_obj_enc = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')
@jamiesun
jamiesun / centos7.sh
Created Sep 11, 2016 — forked from yyang/centos7.sh
centos 7 pptpd firewalld
View centos7.sh
#!/bin/sh
#
# pptpd installation script on my own CentOS 7 box.
# inspired by: https://www.digitalocean.com/community/questions/how-to-install-pptp-vpn-on-centos-7
# and http://unix.stackexchange.com/questions/150837/redhat-centos-7-firewalld-best-practice-for-pptp-or-l2tp-ipsec-rules
#
# Author: 2015 Steve Yang <me@iyyang.com>
# The script comes with ABSOLUTELY NO WARRANTY.
@jamiesun
jamiesun / tun-ping-linux.py
Created Oct 6, 2015 — forked from glacjay/tun-ping-linux.py
Reading/writing Linux's TUN/TAP device using Python.
View tun-ping-linux.py
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2
View twisted_sleep.py
def sleep(secs):
d = Deferred()
reactor.callLater(secs, d.callback, None)
return d
@jamiesun
jamiesun / sh
Created Feb 24, 2015
python color shell
View sh
#!/usr/bin/env python
#coding:utf-8
import sys
import os
import subprocess
import time
class ToughError(Exception):
def __init__(self, message):
self.message = message
View AESCipher
from Crypto.Cipher import AES
from Crypto import Random
import base64
import hashlib
_key = 't_o_u_g_h_radius'
class AESCipher:
View gist:017ebd67fd1528b531fd
# Demonstration of inspecting all the routes, including those on sub-apps,
# from the default app instance.
#
# This should be run directly to print a list of route prefixes and the rules.
# Tested with Python 2.7 and Bottle-dev. Patch here
# https://github.com/davidwtbuxton/bottle/commit/ddd712ef252b06ecd0e957f8ac4e37b65ee79cae
import bottle
subapp = bottle.Bottle()
View paginator.py
#!/usr/bin/env python
#coding=utf-8
from __future__ import division
import math
class Paginator():
"""系统查询分页工具
"""
def __init__(self, url_func, page=1, total=0, page_size=20):
You can’t perform that action at this time.