Skip to content

Instantly share code, notes, and snippets.

@ward
ward / main.md
Created February 6, 2014 11:06
Compare folder structure

tree gives a nice graphical view of folder structure. Notice that this method doesn't let you know about file differences between files of the same name.

tree /path/to/dir1 >file1.txt
tree /path/to/dir2 >file2.txt
git diff file1.txt file2.txt
@ward
ward / trakt-watchlist-popularity.rb
Last active August 29, 2015 14:04
List trakt watchlist by popularity
#!/usr/bin/env ruby
# Lists the movies in your watchlist by their trakt popularity.
# Made this since it is broken for me on trakt.
require 'open-uri'
require 'json'
# You can find this in your profile
API_KEY = ''
@ward
ward / dir.php
Created September 2, 2014 13:37
Read directories/files with PHP (aka your server needs better file permissions)
<pre>
<?php
print_r(scandir($_GET['dir']));
?>
</pre>
@ward
ward / gist:96ce663b3e1b5758531c
Created April 1, 2015 13:38
List IPs for failed root ssh logins, sorted by the amount of tries
grep 'Failed password for root' auth.log | awk '{print $11}' | sort | uniq -c | sort -n
@ward
ward / anagrams
Created April 7, 2015 15:01
Ward Muylaert anagrams
(via: http://datagenetics.com/blog/april12015/index.html)
Here are all the English language sub words that can be made from: WARD MUYLAERT
Min word length: 3
Max number of words: 3
Words excluded:
Must include:
---
# Changes the metadata of all the dates to the modify date in the filesystem
# The -P keeps the modify date itself intact
exiftool -P -"filemodifydate>alldates" SOMEFILE.jpg
# Show date related metadata
exiftool -alldates SOMEFILE.jpg
# Show file modified date
exiftool -filemodifydate SOMEFILE.jpg
@ward
ward / proximususage.js
Created October 7, 2015 08:20
Proximus usage bookmarklet
/**
* Run on https://admit.belgacom.be/eservices/wps/myportal/myBillAndUsage
* Shows the ratios of your current used bandwidth (used / total) and of
* how much of the month has gone by (current amount passed / total amount in month)
*/
function parseBytes(s) {
var gm = /^(\d+) GB (\d+) MB$/;
var g = /^(\d+) GB$/;
var m = /^(\d+) MB$/;
@ward
ward / gist:508743e3e566c87f68e5
Created October 28, 2015 12:15
reenablebrowsersanity.js
document.oncontextmenu = undefined;
document.onselectstart = undefined;
document.oncut = undefined;
document.oncopy = undefined;
document.onpaste = undefined;
document.onmousedown = undefined;
document.onclick = undefined;
@ward
ward / notes.md
Last active November 18, 2015 19:20
Sane running heatmap
@ward
ward / notes.txt
Created February 25, 2016 15:59
Compare music from a while back
find /run/media/ward/warddisk/Muziek/ -printf "%P\n" | sort > ~/tmp/muziek.txt
find /run/media/ward/WARDPOD/music/ -printf "%P\n" | sort > ~/tmp/music.txt
then
git diff the files