Skip to content

Instantly share code, notes, and snippets.

@lkaczanowski
lkaczanowski / ILogExtensions.cs
Created August 20, 2012 09:46
ILog extension for TRACE and VERBOSE log4net levels
public static class ILogExtentions
{
private static readonly log4net.ILog log =
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static void Trace(this ILog log, string message, Exception exception)
{
log.Logger.Log(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType,
log4net.Core.Level.Trace, message, exception);
@willurd
willurd / web-servers.md
Last active July 28, 2024 14:39
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@xfguo
xfguo / udp_client.lua
Created April 12, 2014 16:06
Added UDP server example powered by luaevent.
-- udp-client test
-- based on code from http://blog.chinaunix.net/uid-27194309-id-3499261.htmlEF
local socket = require "socket"
local address = "127.0.0.1"
local port = 8080
local udp = socket.udp()
udp:settimeout(0)
udp:setpeername(address, port)
@0xBADCA7
0xBADCA7 / cors_http_reply.txt
Created December 31, 2015 00:00
A stub for HTTP 200 reply with CORS headers. Useful for piping into netcat when XSS'ing. One reply is for the OPTIONS request.
HTTP/1.1 200 OK
Server: MSLC
Date: Sun, 28 Dec 2015 08:50:04 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
Status: 200 OK
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
@mutability
mutability / OVERLAYFS
Last active May 30, 2024 16:46
readonly root via overlayfs
- install the two shellscripts into the appropriate places under /etc/initramfs-tools
- run update-initramfs
- put "overlay=yes" on the kernel command line
- reboot
With the overlay in place, the real root is mounted readonly on /ro.
Only the root fs is changed, other filesystems are mounted normally.
Remove "overlay=yes" (or change it to something other than yes) and reboot to go back to readwrite.
(This probably means that you want the commandline config to live somewhere other than on the root fs, e.g. under /boot)
@corny
corny / lua-udp.lua
Created July 4, 2016 16:08
Lua UDP example
#!/usr/bin/env lua5.2
--
-- apt install lua5.2 lua-socket
--
local socket = require("socket")
local udp = assert(socket.udp())
local data
udp:settimeout(1)
@eigengrau
eigengrau / firefox-to-org.py
Last active May 11, 2024 16:48
Export Firefox bookmarks to org-mode
#!/usr/bin/env python
# Read a Mozilla places JSON-structure from STDIN and create a directory
# hierarchy of org-mode files containing bookmarks.
# Copyright (c) 2014 Alexey Kutepov a.k.a. rexim
# Copyright (c) 2016 Sebastian Reuße
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
@SkyzohKey
SkyzohKey / screen-spoofer.user.js
Last active June 4, 2024 10:23
~ Spoof the reported window.screen as the most common one so that it can't be used to fingerprint browser.
// ==UserScript==
// @name Spoof screen resolution & color depth
// @namespace https://skyzohlabs.be
// @version 1.0.5
// @description Spoof the reported window.screen as the most common one so that it can't be used to fingerprint browser.
// @author SkyzohKey
// @include http://*
// @include https://*
// @run-at document-end
// @grant none
@BlaM
BlaM / cookiebanner-go-away.user.js
Last active May 18, 2024 16:55
Get rid of EU Cookie Banners (Tampermonkey)
// ==UserScript==
// @name Get rid of EU Cookie Banners
// @namespace http://blog.deobald.org/
// @description Get rid of EU Cookie Banners
// @license http://creativecommons.org/licenses/by-nc-sa/3.0/
// @downloadURL https://gist.githubusercontent.com/BlaM/6d826d6e9d77d2d77bf9a92fdad55788/raw/cookiebanner-go-away.user.js
// @homepage https://gist.github.com/BlaM/6d826d6e9d77d2d77bf9a92fdad55788
// @version 0.3.4
// @author Dominik Deobald
// @match http*://*/*
@tmonjalo
tmonjalo / list-fftabs.py
Created September 13, 2018 10:42
List all Firefox tabs with title and URL
#! /usr/bin/env python3
"""
List all Firefox tabs with title and URL
Supported input: json or jsonlz4 recovery files
Default output: title (URL)
Output format can be specified as argument
"""