Skip to content

Instantly share code, notes, and snippets.

View futpib's full-sized avatar

futpib

View GitHub Profile
@willurd
willurd / web-servers.md
Last active June 21, 2024 13:36
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
@cky
cky / sha12.scm
Last active June 12, 2021 14:00
Scheme implementation of SHA1 and SHA2
;;;; SHA-1 and SHA-2 implementations.
;;;; Uses R7RS bytevector and byte I/O interfaces.
;;;; Requires SRFIs 1, 26, 43, and 60.
;;; Auxiliary definitions to avoid having to use giant tables of constants.
(define primes80 '(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73
79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157
163 167 173 179 181 191 193 197 199 211 223 227 229 233 239
241 251 257 263 269 271 277 281 283 293 307 311 313 317 331
@heyalexej
heyalexej / gsm-setup.md
Last active June 12, 2024 12:35
SIM Card Management Through GSM Modem On Linux

SIM Card Management Over GSM Modem

A small guide on how to send and receive USSD codes on Linux

I am using the built in GSM (UMTS) modem of my Thinkpad X1 extensively because I am often in places with flaky internet connections. I connect through the standard Network Manager on Ubuntu and everything works fine. There was one major annoyance though. Every time I wanted to top up the SIM balance or book a new package, I needed a phone to send and receive USSD codes. So I took some time to figure out how to do it from the shell. I wrote this down as a help for others and a reminder for myself. Without further ado...

First intsall gammu and picocom.

~  sudo apt-get install -y gammu picocom
@Noitidart
Noitidart / _ff-addon-snippet-CancelAJAX.js
Created January 8, 2015 02:43
_ff-addon-snippet-CancelAJAX - Detect if AJAX request and then cancel it.
var {utils: Cu, classes: Cc, instances: Ci, results: Cr} = Components
Cu.import('resource://gre/modules/Services.jsm');
var myobserve = function(aSubject, aTopic, aData) {
var httpChannel = aSubject.QueryInterface(Ci.nsIHttpChannel);
var isXHR;
try {
var callbacks = httpChannel.notificationCallbacks;
var xhr = callbacks ? callbacks.getInterface(Ci.nsIXMLHttpRequest) : null;
@kelleyk
kelleyk / compton.conf
Last active September 19, 2023 12:36
# This is my compton configuration after a quick cleanup. (It's still none too organized; sorry about that.)
# With this file at ~/.config/compton.conf, I can run compton without any arguments (just plain `compton`).
#
# In the hopes that explaining my software and hardware environment might be helpful to you:
#
# I use this configuration on Ubuntu 15.10 (and have used it on previous releases); I am currently using the 352.63 ("long-lived
# branch") NVIDIA binary drivers, installed from the Ubuntu software repositories. I use fluxbox as my window manager; most of
# the other components of my desktop environment are borrowed from Xfce.
#
# My workstation at home has an i7-4930K and a GTX 970 in it, which are together more than enough to drive several 4K displays
@erikreedstrom
erikreedstrom / blank.ex
Created February 13, 2016 17:54
Blank protocol for Elixir
defmodule Blank do
@moduledoc """
Tools around checking and handling undefined or blank data.
"""
@doc """
Returns `true` if data is considered blank/empty.
"""
def blank?(data) do
Blank.Protocol.blank?(data)
@subfuzion
subfuzion / curl.md
Last active June 20, 2024 13:48
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@countingpine
countingpine / ext2scan.c
Last active December 19, 2021 18:06
ext2scan: scan for ext2/ext3/ext4 partitions
/* ext2scan:
* Scans an input stream, sector by sector, for something that looks like an ext{2,3,4} partition.
* It does this by looking for a magic WORD, 0xEF53, at a known offset into the sector.
* For random data, this will occur by chance around once per 32MB of data, so we also
* check whether the first two sectors are all zeros, which is commonly true for ext partitions.
*
* Compile with:
* gcc ./ext2scan.c -o ./ext2scan
*
* Example usage:
@nt1m
nt1m / the-plan.md
Last active September 17, 2017 22:15
<iframe mozbrowser> implementation plan for WebExtensions

Implementing iframe mozbrowser> bug 1318532

Opportunities with this API

  • Tile Tabs
  • Create a wrapper around web content (à la Responsive design Mode)
  • Make use of container tabs properties for iframes
  • More secure alternative to overriding CSP to make web content iframe-able
@wader
wader / Makefile
Created April 11, 2017 18:54
libchromaprint.js
# make sure chromaprint source is in $PWD/chromaprint
# after run use $PWD/chromaprint/libchromaprint.min.js
# does not use --bind and set NO_DYNAMIC_EXECUTION to generate code
# that don't use eval
CC = emcc
CXX = em++
CFLAGS = -O2 -DUSE_KISSFFT=1 -Isrc -Ivendor/kissfft
CXXFLAGS = -O2 -std=c++11 -DUSE_KISSFFT=1 -Isrc -Ivendor/kissfft