Skip to content

Instantly share code, notes, and snippets.

View lotusirous's full-sized avatar
💭
for { Learn() }

Kha Nguyen lotusirous

💭
for { Learn() }
View GitHub Profile
#!/bin/sh
#
# delete all existing rules.
#
IPT='/sbin/iptables'
LAN_IF='eth3'
WAN_IF='eth0'
OPT_IF='eth1'
# WELCOME TO SQUID 3.4.8
# ----------------------------
#
# This is the documentation for the Squid configuration file.
# This documentation can also be found online at:
# http://www.squid-cache.org/Doc/config/
#
# You may wish to look at the Squid home page and wiki for the
# FAQ and other documentation:
# http://www.squid-cache.org/
# WELCOME TO SQUID 3.4.8
# ----------------------------
#
# This is the documentation for the Squid configuration file.
# This documentation can also be found online at:
# http://www.squid-cache.org/Doc/config/
#
# You may wish to look at the Squid home page and wiki for the
# FAQ and other documentation:
# http://www.squid-cache.org/
#!/bin/sh
#
# delete all existing rules.
#
IPT='/sbin/iptables'
LAN_IF='eth4'
WAN_IF='eth0'
OPT_IF='eth1'
iptables -t nat -A POSTROUTING -o eth4 -s 192.168.13.10 -j SNAT --to-source 192.168.9.10
iptables -t nat -A PREROUTING -i eth4 -d 192.168.9.10 -j DNAT --to-destination 192.168.13.10
iptables -A FORWARD -s 192.168.9.10 -j ACCEPT
iptables -A FORWARD -d 192.168.13.10 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth5 -s 192.168.14.10 -j SNAT --to-source 192.168.10.10
iptables -t nat -A PREROUTING -i eth5 -d 192.168.10.10 -j DNAT --to-destination 192.168.14.10
iptables -A FORWARD -s 192.168.10.10 -j ACCEPT
iptables -A FORWARD -d 192.168.14.10 -j ACCEPT
#include <stdio.h>
int main() {
FILE *fp;
char c;
fp = fopen(__FILE__,"r");
do {
c = getc(fp);
putchar(c);
}
while(c != EOF);
rm(list=ls())
data = read.csv('weisberg_fuel.csv',header=TRUE)
X1 <- data$TAX # Tax
X2 <- data$DLIC
X3 <- data$INC
X4 <- data$ROAD
Y <- data$FUEL
@lotusirous
lotusirous / date_range.py
Last active November 30, 2016 12:45
A python script for generate daily and monthly date in range
import datetime
from dateutil import relativedelta
def daterange(start, end, freq="daily"):
if freq == "daily":
number_of_days = int ((end_date - start_date).days) +1
for n in range(number_of_days):
yield start_date + datetime.timedelta(n)
return
@lotusirous
lotusirous / HttpExample.java
Created May 1, 2017 02:45
A Java Example HTTP request with JSON
package a10vulnerability;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.FileNotFoundException;
import org.json.JSONArray;
import org.json.JSONTokener;
@lotusirous
lotusirous / watermark_removing.py
Created May 2, 2017 00:49
Remove watermark in pdf books
import binascii
from optparse import OptionParser
watermark_char = "".join("34 39 30 39 20 30 20 52".split())
unchar_watermark = "".join("00 00 00 00 20 30 20 52".split())
watermark_link = "".join("2F 52 65 63 74 5B 32 36 36 20 35 39 20 33 37 31 20 37 33 5D 20 2F 42 53 20 3C 3C 2F 54 79 70 65 2F 42 6F 72 64 65 72 20 3E 3E 20 2F 42 6F 72 64 65 72 5B 30 20 30 20 30 5D 20 2F 43 5B 30 20 30 20 30 5D 20 2F 41 3C 3C 2F 53 2F 55 52 49 2F 55 52 49 28 68 74 74 70 3A 2F 2F 77 77 77 2E 61 6C 6C 69 74 65 62 6F 6F 6B 73 2E 6F 72 67 29".split())
def remove_watermark(path):
bin_pdf = ""