Skip to content

Instantly share code, notes, and snippets.

View pierskarsenbarg's full-sized avatar

Piers Karsenbarg pierskarsenbarg

View GitHub Profile
@ronaldmansveld
ronaldmansveld / .bash_profile
Created August 18, 2016 09:51
Alias for checking out branch + merging latest master automatically
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
@mitchellh
mitchellh / setup_winrm.txt
Created June 14, 2015 19:31
Packer 0.8 Windows Example on AWS
<powershell>
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow
@Iristyle
Iristyle / Start-Vagrant.bat
Created March 15, 2013 18:35
Windows startup script to fire up a Vagrant VM safely on boot (using Run registry key for instance)
ECHO OFF
cd /d %~dp0
for /f "tokens=2* delims= " %%F IN ('vagrant status ^| find /I "default"') DO (SET "STATE=%%F%%G")
ECHO Close this window if it remains open, and http://localhost:8081 is responsive
IF "%STATE%" NEQ "saved" (
ECHO Starting Vagrant VM from powered down state...
vagrant up
) ELSE (
@jaymzcd
jaymzcd / gist:3748713
Created September 19, 2012 09:37
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@funkatron
funkatron / twitter_sources_collector.php
Created May 10, 2011 00:41
a PHP script to capture twitter source data from the streaming API into MySQL
#!/dh/cgi-system/php5.cgi -q
<?php
$TWITTER_USERNAME = 'foo';
$TWITTER_PASSWORD = 'bar';
$PDO_CONN_URL = 'mysql:host=hostname;dbname=db_name', 'username', 'password';
set_time_limit(0);
function getLinkFromHref($str) {
return htmlspecialchars(preg_replace('/(<a href=")([^"]+)"(.*)/i', '$2', $str), ENT_QUOTES, 'UTF-8');
@aliendeveloper
aliendeveloper / SudokuSolver.class.php
Created March 27, 2011 08:35
A PHP Class to solve the sudoku.
<?php
/**
* @author Anush Prem <goku.anush@gmail.com>
* @package Solver
* @subpackage Sudoku
* @version 0.1
*/
/**
@frankshearar
frankshearar / fake-http-context.cs
Created February 21, 2011 21:28
A Moq-using fake HTTP context to test controllers.
public HttpContextBase FakeHttpContext() {
var context = new Mock<HttpContextBase>();
var files = new Mock<HttpFileCollectionBase>();
var request = new Mock<HttpRequestBase>();
var response = new Mock<HttpResponseBase>();
var session = new Mock<HttpSessionStateBase>();
var server = new Mock<HttpServerUtilityBase>();
var user = new Mock<IPrincipal>();
var identity = new Mock<IIdentity>();
request.Setup(req => req.ApplicationPath).Returns("~/");
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.