Skip to content

Instantly share code, notes, and snippets.

@dantmnf
dantmnf / duppkt.rb
Created December 20, 2014 12:12
script to duplicate outgoing TCP packets
#!/usr/bin/env ruby
require 'socket'
require 'pcaprub'
require 'packetfu'
IDENTIFY_TTL = 105
interface = 'eth0'
DUPS = 1 # number of duplicated packet(s)
SIOCGIFINDEX = 0x8933
@tuxzz
tuxzz / ruce_pcode
Created July 10, 2015 09:30
RUCE_PCode
Function main(arg)
{
/* 解析参数 */
RUCE_UnitParam para = RUCE_ParsePara(arg);
/* 从输入文件名提出音名 例如a.wav变成a */
String inputPath = para.input;
String outputPath = para.output;
String inputFileName = BaseFromFilePath(inputPath);
String inputDirName = DirFromFilePath(inputPath);
@gumblex
gumblex / zip64.py
Created November 14, 2015 11:16
Simple Python command line utility to create Zip64 files.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Simple command line utility to create Zip64 files.
For Python 3.3+
Most code are from the standard library `zipfile` and `shutil`.
"""
@ptz0n
ptz0n / gist:1217080
Created September 14, 2011 16:51
Validate JSONP Callback
<?php
/**
* Validate JSONP Callback
*
* https://github.com/tav/scripts/blob/master/validate_jsonp.py
* https://github.com/talis/jsonp-validator/blob/master/src/main/java/com/talis/jsonp/JsonpCallbackValidator.java
* http://tav.espians.com/sanitising-jsonp-callback-identifiers-for-security.html
* http://news.ycombinator.com/item?id=809291
*
@legastero
legastero / send_image.py
Last active October 10, 2021 16:12
Send an image in a chat message with SleekXMPP
import logging
import threading
import sleekxmpp
logging.basicConfig(level=logging.DEBUG)
class Bot(sleekxmpp.ClientXMPP):
def __init__(self, jid, password):
  1. Plain Strings (207): foo
  2. Anchors (208): k$
  3. Ranges (202): ^[a-f]*$
  4. Backrefs (201): (...).*\1
  5. Abba (169): ^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
  6. A man, a plan (177): ^(.)[^p].*\1$
  7. Prime (286): ^(?!(..+)\1+$)
  8. Four (199): (.)(.\1){3}
  9. Order (198): ^[^o].....?$
  10. Triples (507): (^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
@jaksi
jaksi / main.go
Created December 23, 2016 17:32
Go web server
package main
import (
"bytes"
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net/http"
/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4O//F9NdADoZSs4dkJsneBz/bNOb8/VIi6mfPJyl4E3R
ZPRcjYWVP8ZadAyWoshi62XKsliYPJ3ZGvuyQYNLzaIm/jpS0gzPRcE5gLB+4tZ4uGlPDpE7k9GZ
pq4A8utK90UGiwuv9fBUm9V7i3VqqeviR3k0gMBMFA9ZaFuE8fgVPumm0RVLqzGsMjjVQKeixvOm
PtLetv0A15UkErykYvsVFqJJr0kqcHNgis9Kbs50SRQKwd02jtw6IUeczWWLH8LeY4xJKaI06VwR
HeQSj01Uq7MfDCXB5TG1fcbmQ8wH0mt0TMpj7hSyB/ftQ3ffs0qJsBlD3H8UD2REt5hz+xDlOmKU
dBbrNzWLgibljkgu6kWIXUDVXfXkLQSIFdY0WkA76QfC//SpIwRV44tdxaLR2FcDIuR9hhN4qn+u
J/of6GZC8VtsSvqAe3QbqMrmDQn7c0kD4xQrm6VAg0KaWsOxE57s0TemWRsm+egHoZdkEIu8BkQV
+ceH8rKKJhHSO0oO3Z7psBdd8lJOPpMulPkC/iwq6xEM96YIPBAmYpJ2nI+ppIyxUX2GCuuEUklH
8wBFkbQkMpK42VGEemXFOIBVC7CXr6HFf+4JdVEqxETB4DCExvMTi4W0ULDIvvLh0gHq6DOPweOs
fB4TpzMlthqCBZ/OXyJviy37nUUgIGSZ+KQNN78e2pMFRDfKY1xk+e+zl14mqklRtTBg0o9EsOPR
@kubukoz
kubukoz / cursed.scala
Created November 9, 2022 00:17
git conflicts parsing as Scala
object main extends App {
object <<<<<<< {
def HEAD(s: String) = this
}
implicit class StringOps(s: String) {
def =======(i: Int) = s
def >>>>>>>(i: Int) = i
}
@petrkutalek
petrkutalek / eurionize.sh
Created July 5, 2020 21:43
Adding an EURion constellation to A4 PDF
#!/bin/bash
if [[ "$#" -ne 1 ]]; then
echo "Usage: $0 filename" >&2
exit 1
fi
if [[ ! -e "$1" ]]; then
echo "$1 not found" >&2
exit 1
fi