Skip to content

Instantly share code, notes, and snippets.

@dne
dne / smokeping.psgi
Created Feb 12, 2014
Smokeping PSGI app
View smokeping.psgi
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Emulate::PSGI;
my $app = CGI::Emulate::PSGI->handler(sub {
use CGI;
use Smokeping;
CGI::initialize_globals();
@fdb713
fdb713 / twitter.mute.js
Last active Dec 17, 2015
mute tweets containing specific keyword.
View twitter.mute.js
// origin: @ayanamist
// ==UserScript==
// @name Twitter Timeline URL Expand
// @namespace Twitter-Timeline-URL-Expand
// @description Replace t.co href of A tag with real url.
// @match http://twitter.com/*
// @match https://twitter.com/*
// @version 1.1
// ==/UserScript==
(function (window) {
@scturtle
scturtle / dns.py
Last active Dec 22, 2015
dns proxy server using 0bad.com and ip
View dns.py
import SocketServer
from gevent import monkey
monkey.patch_socket(dns=False)
import requests
from dnslib import *
cache = {'0bad.com': ['69.163.160.212'], 'bitstress.com': ['127.0.0.1']}
def redirect_ip(data, ip='144.214.121.220'):
@bsodmike
bsodmike / howto.md
Last active Aug 30, 2017
HOWTO: Setup mail forwarding with Sendmail in Ubuntu 10.04 LTS
View howto.md

Copyright (c) 2011, Michael de Silva (michael@mwdesilva.com) Blog: http://www.bsodmike.com ~ Twitter: @bsodmike

Fix: 'config error: mail loops back to me (MX problem?)'

To prevent receiving config error: mail loops back to me (MX problem?) errors, you need to add each virtualdomain.tld to the /etc/mail/local-host-names file and re-compile your sendmail config via make.

You have asked mail to a domain (e.g., domain.net) to be forwarded to a specific host (in this case, relay.domain.net) by using an MX record, but the relay machine doesn't recognise itself as domain.net. Add domain.net to /etc/mail/local-host-names [known as /etc/sendmail.cw prior to version 8.10] (if you are using FEATURE(`use_cw_file')) or add "Cw domain.net" to your configuration file.

Source: http://www.sendmail.com/sm/open_source/support/support_faq/general_issues_faq/#4.5

@madeye
madeye / sysctl.conf
Last active Jun 5, 2018
Optimized sysctl.conf for shadowsocks
View sysctl.conf
net.core.wmem_max = 12582912
net.core.rmem_max = 12582912
net.ipv4.tcp_rmem = 10240 87380 12582912
net.ipv4.tcp_wmem = 10240 87380 12582912
net.ipv4.ip_local_port_range = 18000 65535
net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_max_syn_backlog = 3240000
net.core.somaxconn = 3240000
net.ipv4.tcp_max_tw_buckets = 1440000
@sycx
sycx / alipay_acclog.py
Created Feb 28, 2016
Import Alipay ACCLOG file to beancount
View alipay_acclog.py
#!/usr/bin/env python3
import sys
import csv
import argparse
import datetime
def _amount_match(a1,a2):
d1 = float(a1) if a1 else 0
View dns_pollution_iplist.txt
0.0.0.0
1.1.80.147
1.1.127.45
1.33.190.70
1.33.191.58
1.209.208.200
1.234.1.235
1.234.2.155
1.234.4.97
1.234.17.34
@msmuenchen
msmuenchen / gist:9318327
Last active Apr 8, 2022
KeePass v2.x (KDBX v3.x) file format
View gist:9318327
Convention: Byte array notation as it would appear in a hexeditor.
= Layout=
KDBX files, the keepass database files, are layout as follows:
1) Bytes 0-3: Primary identifier, common across all kdbx versions:
private static $sigByte1=[0x03,0xD9,0xA2,0x9A];
2) Bytes 4-7: Secondary identifier. Byte 4 can be used to identify the file version (0x67 is latest, 0x66 is the KeePass 2 pre-release format and 0x55 is KeePass 1)
@koto
koto / crime.py
Created Sep 11, 2012
It's not a crime to build a CRIME
View crime.py
# This is supposedly what CRIME by Juliano Rizzo and Thai Duong will do
# Algorithm by Thomas Pornin, coding by xorninja, improved by @kkotowicz
# http://security.blogoverflow.com/2012/09/how-can-you-protect-yourself-from-crime-beasts-successor/
import string
import zlib
import sys
import random
charset = string.letters + string.digits + "%/+="
@glacjay
glacjay / tun-ping-win.py
Created Sep 19, 2010
Reading/Writing OpenVPN's TUN/TAP Device under Windows using Python.
View tun-ping-win.py
import _winreg as reg
import win32file
adapter_key = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}'
def get_device_guid():
with reg.OpenKey(reg.HKEY_LOCAL_MACHINE, adapter_key) as adapters:
try: