Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dewey's full-sized avatar
👋
Click here to edit status

Philipp Defner dewey

👋
Click here to edit status
View GitHub Profile
@dewey
dewey / gist:5330673
Created April 7, 2013 14:16
Add OpenVPN clients and publish encrypted directory containing cert and config files.
#!/bin/bash
cd /etc/openvpn/easy-rsa/2.0/keys
if [ ! -f $1-openvpn.key ];
then
echo "Please generate the client certificate using: . /etc/openvpn/easy-rsa/2.0/build-key $1-openvpn"
echo "and reinvoke the script."
else
DIRNAME="$1-openvpn"
TMPDIR="/tmp/$DIRNAME"
ENCPW=`openssl rand -base64 32`
@dewey
dewey / rc
Created May 13, 2013 14:03
lftp settings: Add to ~/.lftp/rc
set ssl:verify-certificate no
set pget:default-n 10
set mirror:use-pget-n 10
set mirror:parallel-transfer-count 3
set bmk:save-passwords yes
set xfer:clobber on
execute pathogen#infect()
filetype plugin indent on
syntax on
set hlsearch
set showmatch
set expandtab
set shiftwidth=4
set copyindent
set tabstop=4
set incsearch
@dewey
dewey / lastfm.php
Created June 22, 2013 16:30
Last.fm "now playing" script for Textual. Installation: Replace 'apfeltalkdewey' with your Last.fm username. Copy this script to ~/Library/Application Scripts/com.codeux.irc.textual/lastfm.php Usage: /lastfm
#!/usr/bin/php
<?php
$doc = new DOMDocument();
$doc->load("http://ws.audioscrobbler.com/2.0/user/apfeltalkdewey/recenttracks.xml?limit=1");
$arrFeeds = array();
foreach ($doc->getElementsByTagName('track') as $node) {
$itemRSS = array (
'artist' => $node->getElementsByTagName('artist')->item(0)->nodeValue,
'name' => $node->getElementsByTagName('name')->item(0)->nodeValue
);
@dewey
dewey / gist:7633623
Last active December 29, 2015 07:09
Restoring Textual.app channel order

Why

After accidentally hitting command + R in Textual.app your channel list will get sorted alphabetically. Unfortunately there's currently no way to revert that.

To restore the old settings:

  1. Quit Textual.app
  2. cp /path/to/timemachine/.../com.codeux.irc.textual.plist ~/Library/Containers/com.codeux.irc.textual/Data/Library/Preferences/com.codeux.irc.textual.plist
  3. A Reboot or Relogin is necessary due to Mavericks caching the preference file.

Reassign Shortcut

To prevent this from happening overwrite Textual's shortcut with some obscure shortcut you'll never hit:

cd ~/Documents/Developement/Eclipse/Trash
cp -R code ~
git branch -D abgabe
git checkout --orphan abgabe
git rm -rf .
rm -rf documentation .DS_Store code
git rm -r --cached documentation speisekarten .settings README.md
mv ~/code .
git add code/
git commit -m "Commit: $(date)"
@dewey
dewey / git-deploy.md
Created January 10, 2014 22:39
Deploy websites using git

The local repository

cd ~/sites
mkdir example.com
cd example.com
git init
> Initialized empty Git repository in /Users/dewey/sites/example.com/.git/

The remote repository

@dewey
dewey / config
Last active January 3, 2016 22:09
~/.newsbeuter/config
# Refreshing
auto-reload yes
reload-threads 3
reload-time 20
feed-sort-order unreadarticlecount-asc
# Open links in this browser
browser open
# Write error log
@dewey
dewey / popcorntime.sh
Created February 17, 2014 00:52
Randomly pick a movie from a given directory based on various optional input parameters.
#!/bin/bash
#title : popcorntime.sh
#description : This script picks a random movie from a given directory based on various input parameters.
#author : dewey
#date : 17.02.2014
# Initialise some variables
quality=
extension=
@dewey
dewey / fixcookies.sh
Last active August 29, 2015 13:56
fixcookies.sh
#!/bin/bash
#title : fixcookies.sh
#description : Replace cookie file if pywhatauto breaks it
#author : dewey
#date : 04.03.2014
md5sum=$(which md5sum)
COOKIEDIRECTORY="/home/dewey/pywhatauto/cookies"
if [ -e "$COOKIEDIRECTORY" ]; then