Skip to content

Instantly share code, notes, and snippets.

View madars's full-sized avatar

Madars Virza madars

View GitHub Profile
# NAT6 + masquerading firewall script
# https://github.com/akatrevorjay/openwrt-masq6
# trevorj <github@trevor.joynson.io>
#
# You can configure in /etc/config/firewall per zone:
# * IPv4 masquerading
# option masq 1
# * IPv6 masquerading
# option masq6 1
# * IPv6 privacy extensions
@madars
madars / public-tmux
Created April 30, 2020 01:46
A read-only tmux session for demos and remote debugging
#!/bin/sh
# To be used with something like this in sshd_config:
#
# Match User public-tmux
# X11Forwarding no
# AllowTcpForwarding no
# PasswordAuthentication yes
# ForceCommand /usr/bin/tmux -S /tmp/public-tmux-socket attach -r -t public
#
@madars
madars / vga-align
Created January 23, 2016 06:12
vga-align
#!/bin/sh
FILE=`mktemp -t vga-align-XXX.html`
cat > $FILE <<EOF
<!DOCTYPE html>
<html>
<head>
<title>VGA auto-align pattern</title>
<style type='text/css'>
html, body { margin: 0; padding: 0; }
body { background: url('data:image/gif;base64,R0lGODdhAgACAPAAAAAAAP///ywAAAAAAgACAAACA0QCBQA7') repeat; }
@madars
madars / .gitignore
Last active September 18, 2015 06:12
ODR violation
*.o
*.so
main

Keybase proof

I hereby claim:

  • I am madars on github.
  • I am madars (https://keybase.io/madars) on keybase.
  • I have a public key whose fingerprint is C309 96DA 5A59 8BEE DEFB 6B12 0D73 7D1D B376 22C3

To claim this, I am signing this object:

@madars
madars / fp.py
Created February 6, 2015 04:52
Prime field arithmetic in Python
#!/usr/bin/env python
#
# Author: Madars Virza <madars@mit.edu>
# License: MIT
#
import random
import operator
def ext_gcd(a, b):