Skip to content

Instantly share code, notes, and snippets.

View nippe's full-sized avatar
🏠
Working from home

Niklas Nihlén nippe

🏠
Working from home
View GitHub Profile
$ git push heroku master
@nippe
nippe / boxstarterscript-windev.txt
Last active August 29, 2015 14:15
boxstarter-devbox-win
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions -EnableShowFileExtensions
Set-StartScreenOptions -EnableBootToDesktop -EnableDesktopBackgroundOnStart -EnableShowStartOnActiveScreen -EnableShowAppsViewOnStartScreen -EnableSearchEverywhereInAppsView -EnableListDesktopAppsFirst
Install-WindowsUpdate -acceptEula
Disable-UAC
Disable-InternetExplorerESC
cinst notepad2 -y
cinst SublimeText3 -y
cinst sublimetext3-contextmenu -y
@nippe
nippe / elasticsearch-migration-doorman.rb
Created March 11, 2015 21:48
Elasticsearch index migration
require 'elasticsearch'
require 'redis'
require 'colorize'
unless ARGV.length == 3
puts 'Wrong number of arguments'
puts
puts 'Syntax: ruby migrate-doorman-v1.rb <elasticsearch URL> <source index> <target-index>'
puts 'Example: ruby migrate-doorman-v1.rb http://localhost:9200 doorman-v1 doorman-v2'
exit
@nippe
nippe / cask-install.sh
Created August 18, 2015 13:23
Caskroom install script
# Apps
apps=(
alfred
dropbox
google-chrome
slack
firefox
hazel
spotify
@nippe
nippe / Correct formdata
Last active November 9, 2015 12:27
Formdata using request
var reqeustOptions = {
uri: urljoin(apiBaseUrl, apiBasePath, 'SMS'),
method: 'POST',
auth: {
user: 'username',
pass: 'pwd'
},
form: {
from: fromNubmer,
to: toNumber,
@nippe
nippe / gist:5080813
Created March 4, 2013 08:21
Raspberry Pi /etc/networking/interfaces before editing
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
@nippe
nippe / gist:5233681
Created March 24, 2013 21:46
Raspbery Pi /etc/network/interfaces - wifi configured
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid network-name
wpa-psk password
@nippe
nippe / gist:5282104
Last active December 15, 2015 15:29
Script for logging some 1wire data to Cosm.org
require 'cosm-rb'
require 'json'
require 'ap'
def get_path_for_family path, directory_path
family = File.open(File.join(path, directory_path, 'family')).gets.strip.to_i
if family == 28
File.join(path, directory_path, 'temperature')
elsif family == 26
File.join(path, directory_path, 'humidity')
@nippe
nippe / gist:5282338
Created March 31, 2013 22:53
Logging datapoints to tempo-db.com.
require 'tempodb'
def get_path_for_family path, directory_path
family = File.open(File.join(path, directory_path, 'family')).gets.strip.to_i
if family == 28
File.join(path, directory_path, 'temperature')
elsif family == 26
File.join(path, directory_path, 'humidity')
else
nil
@nippe
nippe / gist:5795761
Last active December 18, 2015 14:18
Route in NancyFX using LightningCache's AsCacheable extention method.
Get["/builds/progress"] = _ => {
IList<IBuildInProgress> builds = serviceAgent.GetBuildsInProgress();
return Response.AsJson(builds).AsCacheable(DateTime.Now.AddSeconds(10)) ;
};