Skip to content

Instantly share code, notes, and snippets.

@sebastianwagner
sebastianwagner / zeropadding.sh
Created June 26, 2013 07:39
Generate list of numbers with zero padding in front. Adjust size of padding according to length of maximum given.
export Y=100; Z=${#Y}; for x in $(seq 1 $Y); do echo $(printf "%0"$Z"d" $x); done
@sebastianwagner
sebastianwagner / concat_csv_files.sh
Created June 26, 2013 09:41
Concatenate CSV files by taking heading first line of first file and appending all non-first-lines of remaining files.
#!/bin/sh
OUTFILE='outfile.csv'
#get header from first line of first file
head -n 1 result*_01_*.csv > "$OUTFILE"
#collect bodies for concatenation and append
tail --silent --lines=+2 result*_*_*.csv >> "$OUTFILE"
@sebastianwagner
sebastianwagner / bluetooth.js.diff
Created July 2, 2013 15:16
Fix gnome3 js fuckup in bluetooth component throwing errors when logging in.
diff --git a/bluetooth.js b/bluetooth.js
index f6d2f30..8af2fd3 100644
--- a/bluetooth.js
+++ b/bluetooth.js
@@ -93,6 +93,7 @@ const Indicator = new Lang.Class({
},
_updateKillswitch: function() {
+ if(typeof GnomeBluetoothApplet == 'undefined' || typeof GnomeBluetoothApplet.killswitch_state == 'undefined') return;
let current_state = this._applet.killswitch_state;
@sebastianwagner
sebastianwagner / ruby.nanorc.diff
Created July 5, 2013 08:00
Update for ruby.nanorc to support Vagrantfile with syntax highlighting
diff --git a/ruby.nanorc b/ruby.nanorc
index b30b229..3bdfd81 100644
--- a/ruby.nanorc
+++ b/ruby.nanorc
@@ -1,6 +1,6 @@
## Here is an example for Ruby.
##
-syntax "ruby" "\.rb$"
+syntax "ruby" "Vagrantfile|\.rb$"
header "^#!.*/ruby[-0-9._]*"
@sebastianwagner
sebastianwagner / virtualbox.extpack.sh
Last active December 19, 2015 09:29
Install Virtualbox Extension Pack
#!/bin/sh
# @see http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html#extpack for current version
EXTPACK='http://download.virtualbox.org/virtualbox/4.2.16/Oracle_VM_VirtualBox_Extension_Pack-4.2.16-86992.vbox-extpack'
cd $(mktemp -d) \
&& wget "$EXTPACK" \
&& sudo VBoxManage extpack install *.vbox-extpack --replace
@sebastianwagner
sebastianwagner / localhost.rdp
Created July 5, 2013 10:15
Connect to localhost via RDP with default port
#open remmina and selct import
full address:s:localhost:3389
auto connect:i:1
compression:i:0
@sebastianwagner
sebastianwagner / magento_adminpassword.sh
Created July 11, 2013 08:19
Create password hashes for magento using salt from stdin or terminal requires pwgen
#!/bin/sh
# magento_adminpassword.sh
#
# reads an password from stdin or terminal and creates hash with salt for magento
# USAGE
# echo hai | ./adminpassword.sh
# or
# ./adminpassword.sh
@sebastianwagner
sebastianwagner / lotustime.php
Created October 11, 2013 08:02
Converts Timestamp from LotusNotes format into Unix one
<?php
const LOTUS_TIME_FORMAT = '%Y%m%dT%H%M%S,';
function lotusTime2UnixTime($srcValue){
//Example 20110413T084135,95+02
/* in PHP5.3
$time = new DateTime();
$time->createFromFormat('Ymd\THis,uO', $srcValue);
$dstValue = intval($time->format('U')); */
$t = strptime($srcValue, LOTUS_TIME_FORMAT);
@sebastianwagner
sebastianwagner / firmware.HpLjP1005.fritzbox.sh
Created January 21, 2014 21:23
Firmware upload helper for HP printer via AppSocket/JetDirect aka raw-socket
#!/bin/sh
# sudo getweb P1005
nc -q 4 fritz.box 9100 < /lib/firmware/hp/sihpP1005.dl
#!/bin/sh
# splash.sh
HOST=$(/sbin/ip route | awk '/default/ { print $3 }')
#echo \
curl \
-d target_url=stern.de_2F \
-d password=Hotspot \