Skip to content

Instantly share code, notes, and snippets.

@goodevilgenius
goodevilgenius / resume.md
Last active October 26, 2017 14:11
[My Résumé] in Markdown format #resume #work

Dan Jones


5501 Alderbrook Ct #5501 • Rockville, MD 20851
+1 (704) 326-1626 • dan@danielrayjones.com

Summary

Web developer with broad experience in both large (educational and commercial) and small(commercial) websites. Designed custom web applications from the ground up, and modified existing open-source applications to meet specific needs. Effective communicator, with experience researching and writing content for educational websites. Social media expertise maintaining Facebook and Twitter accounts for educational institution, and building Facebook applications.

@goodevilgenius
goodevilgenius / my_memory.php
Last active October 26, 2017 14:12
[MyMemory Translate] This PHP script will take the text from stdin, and pass it through the translation service at MyMemory. #translation
#!/usr/bin/php
<?php
$totranslate = file_get_contents('php://stdin');
if (strlen($totranslate) > 1500) {
file_put_contents("php://stderr", "Truncating text to 1500 characters");
$totranslate = substr($totranslate, 0, 1500);
}
@goodevilgenius
goodevilgenius / desc_to_cont_rss.php
Last active October 26, 2017 14:13
[RSS description to content] Transforms an RSS feed, making the content:encoded the same as description #RSS
<?php
/**
To use, place desc_to_cont_rss.php somewhere within your webroot. Then point your browser to http://localhost/desc_to_cont_rss.php?rss=http://example.com/feed.rss
Adjust the paths appropriately for your setup. You may need to urlescape the path to the feed, e.g. http%3A%2F%2Fexample.com%2Ffeed.rss
*/
$rss = $_GET['rss'];
if (empty($rss)) {
$http = "400 Bad Request";
@goodevilgenius
goodevilgenius / media-categories.php
Last active October 26, 2017 14:15
[WP Media Categories] Wordpress plugin to add categories and tags to media items #Wordpress
<?php
/**
* Plugin Name: Media Categories and Tags
* Plugin URI: https://gist.github.com/goodevilgenius/755bc2e7b78ee0b26890
* Description: Adds categories to media
* Version: 0.3.0
* Author: Dan Jones
* Author URI: http://danielrayjones.com/
* License: MIT
*/
@goodevilgenius
goodevilgenius / reddit_rss_relinker.php
Last active October 26, 2017 14:16
[Reddit RSS Relinker] Modifies Reddit RSS feeds so that the links go to the original URL, rather than the comments page. Also adds author. Can optionally filter based on regular expressions. #RSS #Reddit
<?php
$url = $_GET['url'];
if (!preg_match('@http://(www\.)?reddit\.com/r/([A-Za-z0-9]+)\.rss@', $url)) {
header("HTTP/1.0 400 Invalid Reddit RSS URL");
exit;
}
@goodevilgenius
goodevilgenius / shrinkMKV.sh
Last active October 26, 2017 14:35
[vid shrinker] This shrinks videos. The result is a 320x240 mkv with xvid video and ogg audio. Good for putting on a device with a small screen and limited memory. #video #obsolete
#!/bin/sh
while [ "$#" -ne 0 ]; do
EXT="${1##*.}"
FILENAME=`basename "$1" .${EXT}`
TMP=`mktemp`
ffmpeg -i "$1" -s 320x240 -vcodec xvid -an "${TMP}.avi"
ffmpeg -i "$1" -vn "${TMP}.wav"
@goodevilgenius
goodevilgenius / wmctrlplus.sh
Last active October 26, 2017 14:35
[wmctrlplus] A convenience script to make some things easier with wmctrl. Probably your window manager can do this stuff already, though. I don't use it anymore #desktop #obsolete
#!/bin/sh
function GetNext() {
CURR=$(wmctrl -d | grep '^[[:digit:]]*[[:blank:]]*\*' | sed 's/^\([[:digit:]]*\).*/\1/')
LAST=$(wmctrl -d | tail -1 | sed 's/^\([[:digit:]]*\).*/\1/')
TOTAL=$(expr $LAST + 1)
NEXT=$(expr $(expr $CURR + 1) % $TOTAL)
echo $NEXT
}
@goodevilgenius
goodevilgenius / addfortune.sh
Last active October 26, 2017 14:36
[Add fortune] Add a "fortune" to a fortune file, to be used with the Unix fortune program. fortune is read from stdin, and any arguments are taken to be the source of the quote. #obsolete
#!/bin/bash
# Now included in https://github.com/goodevilgenius/fortune-drj/
DIR="${HOME}/.fortune/files"
FILE="quotes-$(date +%Y-%m)"
quote=`mktemp`
[ ! -d "$DIR" ] && mkdir -p "$DIR"
@goodevilgenius
goodevilgenius / addTag.sh
Last active October 26, 2017 14:38
[Email tagger] Used from a procmail filter to tag email, using the X-Tags header. Reads email from stdin. Writes tagged email to stdout. Usage: addTags.sh tag1 tag2 tag3 ... #email #procmail
#!/bin/bash
if [ -z "$1" ]
then
cat
exit
fi
tmp=$(mktemp -t addTag.XXXXXX)
@goodevilgenius
goodevilgenius / random_wallpaper.sh
Last active October 26, 2017 14:39
[Random Wallpaper] Scraper to get a random wallpaper from various websites. Most are broken. Uses fbsetbg (fluxbox) and gsettings (Gnome 3/Unity) to set background. #desktop #obsolete
#!/bin/bash
IMG_DIRECTORY="${HOME}/.random_wallpaper"
function setit() {
fbsetbg -a "$(readlink -f "$1")"
gsettings set org.gnome.desktop.background picture-uri "file://$(readlink -f "$1")"
}
function flik() {