Skip to content

Instantly share code, notes, and snippets.

View mg6's full-sized avatar
He who controls the spice controls the universe.

Maciej Gamrat mg6

He who controls the spice controls the universe.
View GitHub Profile
@mg6
mg6 / wu.py
Last active August 29, 2015 14:17
W-machine interpreter written in Python
#!/usr/bin/env python3
#
# wu.py - W-machine interpreter written in Python
# Copyright (C) 2015 Maciej Gamrat <maciej@gamrat.it>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#!/bin/bash
# Public domain.
curl -sSL "http://www.helax.cz/playlist" |
xmllint --html --format - 2>/dev/null |
awk -- 'match($0, /data-target="#pl-d([0-9]+)"/, m) {d = m[1]}; match($0, /class="time"[^0-9]+([0-9:]+)<.+span> +(.+) +<\/li/, m) {print d, m[1], m[2]}'
@mg6
mg6 / influxping
Last active April 7, 2023 02:32
influxping — report ping results to InfluxDB
#!/bin/bash
# MIT License
#
# Copyright (c) 2016 Maciej Gamrat
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@mg6
mg6 / digitalocean-ping.sh
Created March 12, 2017 20:24
DigitalOcean datacenter ping
#!/bin/bash
export LC_ALL=C
curl -s "http://speedtest-ams2.digitalocean.com/" \
| grep -Eo "speedtest\-.+.digitalocean.com" \
| while read -r addr; do
echo -n "$addr "
ping -c5 -w3 "$addr" | tail -1 | awk -F / -- '{print $5, $0}'
done
@mg6
mg6 / cleanup-drafts
Last active May 28, 2018 21:54
Draft cleanup
#!/bin/bash
# MIT License
#
# Copyright (c) 2018 Maciej Gamrat <maciej@gamrat.it>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#!/bin/bash
# MIT License
#
# Copyright (c) 2018 Maciej Gamrat <maciej@gamrat.it>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@mg6
mg6 / ufw.md
Created October 5, 2018 19:50 — forked from kimus/ufw.md
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@mg6
mg6 / hb_all_books_dl.js
Created November 5, 2018 22:04 — forked from galexrt/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
type “about:plugins” in the address bar and disable chrome's pdf viewer
*/
var pattern = /(MOBI|EPUB|PDF|PDF( ?\(H.\))?|CBZ|Download)$/i;
@mg6
mg6 / anime-js-fireworks-canvas-demo.markdown
Created January 31, 2019 21:50
Anime.js Fireworks canvas demo

Keybase proof

I hereby claim:

  • I am mg6 on github.
  • I am mgamrat (https://keybase.io/mgamrat) on keybase.
  • I have a public key ASCbLDWlU__v15rzLlBWV3kTpdNynyXaDtZ7pIISeDDG3wo

To claim this, I am signing this object: