Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#
# @author Sebastian Wagner <2000sw@gmail.com>
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <2000sw@gmail.com> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer, club-mate or pizza in return
# ----------------------------------------------------------------------------
#!/bin/sh
# splash.sh
HOST=$(/sbin/ip route | awk '/default/ { print $3 }')
#echo \
curl \
-d target_url=stern.de_2F \
-d password=Hotspot \
@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);
@varinen
varinen / file_custom_option_script.php
Last active May 25, 2018 07:22
Dynamically adding a file type custom option to multiple products (IDs 100, 101, and 102) in Magento.
<?php
require_once 'app/Mage.php';
Mage::app('default');
$productIds = array(100, 101, 102);
$option = array(
'title' => 'Test Option',
'type' => 'file',
'is_require' => 1,
@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 / 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 / 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 / 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 / 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 / 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"