Skip to content

Instantly share code, notes, and snippets.

@funzoneq
funzoneq / gist:4701943
Created February 3, 2013 14:10
Starting MongoDB on Mac OS X
sudo touch /var/log/mongodb.log
sudo nano /Library/LaunchDaemons/org.mongo.mongod.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.mongo.mongod</string>
<key>RunAtLoad</key>
@funzoneq
funzoneq / gist:4761775
Created February 12, 2013 11:47
Drop al non RIPE ip blocks. Simple trick for DDoS mitigation on dutch-language sites.
/sbin/iptables -A INPUT -s 0.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 1.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 3.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 4.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 6.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 7.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 8.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 9.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 10.0.0.0/8 -j DROP
/sbin/iptables -A INPUT -s 11.0.0.0/8 -j DROP
@funzoneq
funzoneq / bgpq3.spec
Created April 4, 2013 09:18
Spec file for bgpq3
Name: bgpq3
Version: 0.1.18
Release: 2%{?dist}
Group: System/Utilities
Summary: Automate BGP filter generation based on routing database information
URL: http://snar.spb.ru/prog/bgpq3/
License: GPL
Source0: http://snar.spb.ru/prog/bgpq3/bgpq3-0.1.18.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@funzoneq
funzoneq / mib2yaml
Created May 9, 2013 13:11
A mib to yaml converter for SNMP::MIB based of https://github.com/axic/rsnippets/blob/master/mib2yaml.rb Requires libsmi
# MIB2YAML converts MIB files to YAML files for the Ruby SNMP library with support for imports
#
# The code is heavily based on http://snmplib.rubyforge.org/, the only addition is the "find imports" block
require 'rubygems'
require 'fileutils'
require 'yaml'
module MIB2YAML
def MIB2YAML.convert(module_file, mib_dir = '.')
@funzoneq
funzoneq / ruby ssl fun
Created August 13, 2013 11:41
Analyze SSL certs in ruby
#!/usr/bin/env ruby
require 'OpenSSL'
require 'timeout'
require 'socket'
require 'pp'
hostname = "secure.assets.tumblr.com"
def verify_ssl_certificate(preverify_ok, ssl_context)
@funzoneq
funzoneq / gist:6221957
Created August 13, 2013 14:51
tor2web for e-mail, in combination with http://styx.org/ww/2011/12/torfix.txt
import asyncore
from smtpd import SMTPServer
import smtplib
import email
class EmlToTorServer(SMTPServer):
no = 0
def process_message(self, peer, mailfrom, rcpttos, data):
torrcpttos = []
#!/usr/bin/env python
from soco import SoCo
import requests
from pprint import pprint
pl = requests.get("http://22tracks.com/api/tracks/20")
playlist = pl.json()
file = playlist[0]['filename']
@funzoneq
funzoneq / gist:973d6a90eb93f3c9c947
Created July 3, 2014 14:12
22tracks playlists with a sonos queue
#!/usr/bin/env python
import soco
import requests
from pprint import pprint
playlistnr = 20
path = 128
def get_playlist(playlistnr):
pl = requests.get("http://22tracks.com/api/tracks/%s" % playlistnr)
@funzoneq
funzoneq / gist:7226d81e271e5f6f86d3
Last active August 29, 2015 14:04
Login for LeasewebCDN API
#!/usr/bin/env ruby
require 'digest/sha1'
require 'httparty'
require 'pp'
api_key = '0bf62365d36d6114ea546e47f3d0c9ecf57c2de9'
customer_number = '140760000'
class LeasewebCDN
@funzoneq
funzoneq / ubuntu.ks
Last active January 17, 2023 23:23
Ubuntu kickstart file
#Generated by Kickstart Configurator
#platform=x86
# Fetch content from here
url –url http://nl.archive.ubuntu.com/ubuntu/
#System language
lang en_US.UTF-8
#Language modules to install