Skip to content

Instantly share code, notes, and snippets.

View ward's full-sized avatar

Ward Muylaert ward

View GitHub Profile
@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 / 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 / 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 / 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 / gist:8742475
Last active October 21, 2015 21:08
Dump rtsp into mp4 file
ffmpeg -i rtsp://yourlinkhere -acodec copy -vcodec copy FILENAME.mp4
@ward
ward / main.md
Created June 26, 2013 09:11
Odd audio snippet
@ward
ward / challenges.xml
Created April 24, 2012 17:44
STK - after player ID rewrite
<?xml version="1.0"?>
<challenges>
<gameslot playerID="4f96e52e163bbd2e" kart="" firstTime="false">
<city>
<easy solved="false"/>
<medium solved="false"/>
<hard solved="false"/>
</city>
<farm>
<easy solved="true"/>
@ward
ward / gist:1636568
Created January 18, 2012 23:43
SwiftIRC Unreal - block reverse
--- channel.c.old 2012-01-19 00:42:31.859634901 +0100
+++ channel.c 2012-01-19 00:42:52.066301195 +0100
@@ -796,7 +796,7 @@
char *c;
for (c = msgtext; *c; c++)
{
- if (*c == 3 || *c == 27 || *c == 4)
+ if (*c == 3 || *c == 27 || *c == 4 || *c == 22)
return (CANNOT_SEND_NOCOLOR);
}
@ward
ward / gist:1636461
Created January 18, 2012 23:18
SwiftIRC Unreal - strip reverse
--- m_message.c.old 2012-01-19 00:17:45.142995611 +0100
+++ m_message.c 2012-01-19 00:17:58.849662027 +0100
@@ -1350,7 +1350,7 @@
rgb = 1;
nc = 0;
}
- else
+ else if (*text != '\026') /* (strip reverse too) */
{
new_str[i] = *text;
@ward
ward / gist:1636203
Created January 18, 2012 22:23
Old mIRC input mode script
; Allows setting modes by simply typing "+MODE" or "-MODE"
on *:INPUT:#:{
if (!$inpaste && !$ctrlenter && $regex($1,/^[+-][qaohv\Q $+ $remove($chanmodes,$chr(44)) $+ \E]/)) {
haltdef
mode $chan $$1-
}
}