Skip to content

Instantly share code, notes, and snippets.

View icedraco's full-sized avatar
🐲
Rawr

Artex icedraco

🐲
Rawr
View GitHub Profile
@icedraco
icedraco / shrinkpdf.sh
Created October 28, 2016 10:24
PDF optimization script by Alfred Klomp
#!/bin/sh
# http://www.alfredklomp.com/programming/shrinkpdf
# Licensed under the 3-clause BSD license:
#
# Copyright (c) 2014, Alfred Klomp
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@icedraco
icedraco / ddwrt-firewall.sh
Created August 9, 2016 23:29
DD-WRT Firewall Script - Bridring local network to remote Internet-enabled network via WiFi (Client Mode)
# NOTE: Follow the bridge separation guide here first:
# https://www.dd-wrt.com/wiki/index.php/Separate_LAN_and_WLAN
iptables -I FORWARD -i br0 -m state --state NEW -j ACCEPT
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
iptables -I FORWARD -i br1 -o br0 -m state --state NEW -j DROP
iptables -i FORWARD -i br1 -d `nvram get lan_ipaddr`/`nvram get lan_netmask` -m state --state NEW -j DROP
iptables -t nat -I POSTROUTING -o br1 -j SNAT --to 10.0.0.254
iptables -I INPUT -i br1 -m state --state NEW -j DROP
@icedraco
icedraco / inventory.py
Created August 1, 2016 16:27
Furcadia / BTA Inventory Check Script (exports `info of multiple characters into a CSV file)
###--# BTA Inventory Check 1.0b
# This script was built to mass-check the inventory of many Furcadia characters
# and document the results.
#
# Author: Artex / IceDragon <[email protected]>
#
import re
import socket
import csv
@icedraco
icedraco / generate.py
Created July 28, 2016 00:30
Simplistic WPA password dictionary file generator
def str_reverse(s):
t = [z for z in s]
t.reverse()
return "".join(t)
def str_plus_reverse(s):
return s + str_reverse(s)
@icedraco
icedraco / hosts
Created July 2, 2016 12:51
Skype anti-ad hosts file entries
# Block Skype ads
127.0.0.1 *.msads.net
127.0.0.1 *.msecn.net
127.0.0.1 *.rad.msn.com
127.0.0.1 *.adnexus.net
127.0.0.1 a.ads2.msads.net
127.0.0.1 ac3.msn.com
127.0.0.1 ad.doubleclick.net
127.0.0.1 adnexus.net
127.0.0.1 adnxs.com
@icedraco
icedraco / protocol-obfuscator.py
Created April 18, 2016 00:52
Protocol Obfuscator (aka: University Firewall Countermeasure)
# Protocol Obfuscator (aka: University Firewall Countermeasure)
#
# This little script was made to punch a hole through the anti-SSH firewall
# rule my university seems to have added for the server I use. The rule resets
# connections that seem to exhibit OpenSSH banner/signature in them, which
# kinda sucks, since I can't just pick another port: I have to hide that SSH
# banner somehow.
#
# This script comes in pairs:
# * station: sits on the server itself, on an accessible (FW-unaffected) port
@icedraco
icedraco / MinaMultiConnTestDriver.java
Created February 24, 2016 14:29
Example code for Apache MINA sockets
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.transport.socket.nio.NioSocketConnector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
@icedraco
icedraco / copy-headers.py
Created February 19, 2016 10:08
A piece of code that copies the first line from file A into file B. Used to copy CSV headerss
# We take CSV headers from this file...
src_file = "source.csv"
# ...and add to this file as the first line
dst_file = "destination.csv"
# Output file that's created (to avoid possibly damaging the destination file)
output_file = "output.csv"
@icedraco
icedraco / Makefile
Created February 14, 2016 10:02
OpenGL Testing Template
RM = /bin/rm
CC = /usr/bin/g++
CC_FLAGS = -pthread -std=c++11 -ggdb
LIB = -L/usr/lib/x86_64-linux-gnu/ -lpthread -lglut -lGL -lGLU
INCLUDE = -I/usr/include/GL/
# File names
# EXECUTION:
# make && GL_PRELOAD=/usr/lib/x86_64-linux-gnu/libpthread.so ./ass
@icedraco
icedraco / sort-jpegs.py
Created February 1, 2016 11:46
Sort a crapload of JPEG files from lectures into folders by date
from glob import glob
import os
# Extract the date (YYYY-MM-DD) part of the filename
def get_date(filename):
return filename.split(' ')[0]
# Obtain a list of all .jpg files in the current dir
# File format: "YYYY-MM-DD HH.mm.ss.jpg"
files = glob('*.jpg')