Skip to content

Instantly share code, notes, and snippets.

View webRat's full-sized avatar

Todd Rafferty webRat

View GitHub Profile
@webRat
webRat / git_commands
Created June 23, 2011 02:38
9 Common Git Commands
git init - navigate to the appropriate directory and just type that.
git add . - adds everything in that path
git commit -m 'stuff' - Commits with the message 'stuff'
git branch - views branches
git checkout -b <new branch> - Creates & switches to new branch
git checkout <branch> - switches to branch
git merge <branch> - merges that branch to the existing branch that you're already in.
git branch -d <branch> - deletes branch
git push - This assumes you already have a remote setup (like github)
@webRat
webRat / backup.bat
Created August 29, 2012 15:27
Windows Batch File for backing up a db
@echo off
set HOSTNAME=
set USERNAME=
SET SQLPASSWORD=
SET FILENAME=
SET BACKUPPATH=D:\Dev\SQL Server 2005 Express\datafiles\backup
SET BACKUPSQLSCRIPT=%BACKUPPATH%\dbbackup.sql
:: execute backup SQL script
sqlcmd -S %HOSTNAME% -U %USERNAME% -P %SQLPASSWORD% -i "%BACKUPSQLSCRIPT%"
::7zip the bastard
@denuno
denuno / gist:5864210
Created June 26, 2013 02:11
handle file upload as stream example
component {
jServletFileUpload = createObject("java","org.apache.commons.fileupload.servlet.ServletFileUpload");
jStreams = createObject("java","org.apache.commons.fileupload.util.Streams");
jByteArrayOutputStream = createObject("java","java.io.ByteArrayOutputStream");
function getFormItems() {
//var out = getPageContext().getResponse().getWriter();
var htRequest = getPageContext().getRequest();
var bao = jByteArrayOutputStream.init();
@loghound
loghound / gist:5970802
Last active December 19, 2015 14:39
Showing an alternate way to support OO in go (original reference http://www.goinggo.net/2013/07/object-oriented-programming-in-go.html)
package main
import (
"fmt"
)
type Animal struct {
Name string
mean bool
}
@alecthegeek
alecthegeek / go-install-tools
Last active September 3, 2015 18:18
Set up a "standard" go project workspace with support for 3rdparty modules, version control repo and a template main package
# Install all the Go tools and godep tool
# Location of gobin is based on installation by OS X Homebrew
sudo -u admin GOPATH=/tmp GOBIN=/usr/local/opt/go/bin go get -u golang.org/x/tools/cmd/...
sudo -u admin GOPATH=/tmp GOBIN=/usr/local/opt/go/bin go get -u github.com/tools/godep
// junkterm is a quick and dirty serial terminal.
package main
import (
"io"
"log"
"os"
"github.com/pkg/term"
"github.com/spf13/cobra"
@Nitecon
Nitecon / gov
Last active June 29, 2016 15:31
gov provides a way to create vendor experiment setups directly (Requires mac / linux)
#!/bin/bash
GOSRC="$GOPATH/src/"
CURPATH=`pwd`
if [ -z "$GOPATH" ]; then
echo "Need to set GOPATH"
exit 1
fi
if ! [[ $GOPATH == */ ]]; then
@dansimau
dansimau / go.sh
Last active November 30, 2017 17:02
Bash functions for navigating Go workspaces ("Go-go!")
#
# Change to the directory of the specified Go package name.
#
gg() {
paths=($(g "$@"))
path_index=0
if [ ${#paths[@]} -gt 1 ]; then
c=1
@jessfraz
jessfraz / boxstarter.ps1
Last active July 7, 2024 22:46
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt: