Skip to content

Instantly share code, notes, and snippets.

View ward's full-sized avatar

Ward Muylaert ward

View GitHub Profile
@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
# Counts lines from all files in this directory and below it
# Ignores hidden files (to make it include hidden files, change
# the * wildcard to a .
line_ctr=0; for file in `find * -type f`; do echo $file `cat $file | wc -l`; line_ctr=$line_ctr+`cat $file | wc -l`; done; echo $((line_ctr))
@ward
ward / cursify
Created September 29, 2011 19:48
[Not mine] Takes ASCII from stdin, shows it in fancy mathematical symbols
#!/usr/bin/env python
# vim: set fileencoding=UTF-8 :
#
# Copyright (c) 2010, Jonas Häggqvist <rasher@rasher.dk>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
Detail top: H 0 - S 7 - L 41
Background top: H 0 - S 0 - L 0
Detail bottom: H 0 - S 7 - L 41
Background bottom: H 12 - S 7 - L 83
@ward
ward / google-plus-one-bookmarklet.js
Created November 26, 2011 21:01
Google +1 Bookmarklet
(function() {
var a,b;
a=document.createElement('script');
a.type='text/javascript';
a.async=true;
a.src='https://apis.google.com/js/plusone.js';
b=document.createElement('div');
b.id='ward_plusone';
b.style.position='fixed';
b.style.top='10px';