Skip to content

Instantly share code, notes, and snippets.

View jennings's full-sized avatar
🦄
What a mess I've made

Stephen Jennings jennings

🦄
What a mess I've made
View GitHub Profile
@jennings
jennings / git-cheatsheet.md
Last active September 27, 2015 15:47
Miscellaneous Git commands

Rebase the changes branch-base..branch-head onto the master branch

git rebase --onto master branch-base branch-head

Cherry-pick the changes in B since it diverged from A onto the current branch

git checkout base-branch
git cherry-pick A..B
@jennings
jennings / BatchfileTricks.cmd
Last active June 15, 2020 07:19
Stupid batch file tricks
:: Sleep for N seconds:
ping localhost -n N -w 1
:: Get the date and time (US LOCALE ONLY)
set YEAR=%DATE:~-4,4%
set TWOYEAR=%DATE:~-2,2%
@jennings
jennings / install-rhodecode.rst
Last active March 28, 2024 21:13
Step-by-step instructions for installing RhodeCode 1.3.6 on Ubuntu Server 12.04 with Nginx 1.2.1 as the reverse proxy. This was written when these were the latest versions; add a comment if the scripts need to change to accommodate changes in newer versions.The script assumes you want to use a SQLite database. Sorry, you'll need to find another …

Setting up RhodeCode on Ubuntu Server 12.04

Goal

  • Everything running on a single Ubuntu Server
  • RhodeCode running in a virtualenv
  • Use SQLite as the database
@jennings
jennings / UpdateQuery.sql
Created July 31, 2012 15:17
Composing an update query
--- While composing an update query, it's useful to use
--- a SELECT statement first to make sure you're going to
--- update the correct rows. Formatting the query in
--- this manner lets you alternate between SELECT and UPDATE
--- without commenting and uncommenting parts of the query.
SELECT *
FROM
-- UPDATE TableToUpdate --- Use ALT + Drag to highlight this update
@jennings
jennings / osx-setup.sh
Last active December 9, 2015 18:49
Various OS X setup commands
# Lots of these are from https://github.com/pangratz/osx-defaults
# Allow key repeat instead of pop-up accent selector in OS X 10.8
defaults write -g ApplePressAndHoldEnabled -bool false
# Always show scrollbars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
# Show the ~/Library folder
chflags nohidden ~/Library
@jennings
jennings / UpdateSysinternals.cmd
Created January 12, 2013 06:11
Automatically update a folder full of Sysinternals tools
@echo off
pushd \\live.sysinternals.com\tools
xcopy * %~dp0 /Y /D
popd
@jennings
jennings / biggitstuff.sh
Created May 22, 2013 01:27
Lists all objects in a Git database and lists them in descending order of size.
# From: http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history/
git rev-list --objects --all | sort -k 2 > allfileshas.txt
git gc && git verify-pack -v .git/objects/pack/pack-*.idx | egrep "^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$" | sort -k 3 -n -r > bigobjects.txt
for SHA in `cut -f 1 -d\ < bigobjects.txt`; do
echo $(grep $SHA bigobjects.txt) $(grep $SHA allfileshas.txt) | awk '{one=$1; three=$3;$1=$2=$3=$4=$5=$6=""; print one,three,$0}' >> bigtosmall.txt
done;
@jennings
jennings / combine-unrelated-branches.sh
Last active December 17, 2015 23:59
Tools I'm using to join a few unrelated repositories into one
#!/bin/sh
# Combines together unrelated branches into the current commit.
#
# Usage: combine-unrelated-branches.sh <merge-head>+
#
# combine-unrelated-branches.sh repo1/stuff repo2/stuff
NEW_TREE=$(mktemp -t $(basename $0))
@jennings
jennings / AtlassianWidthTweaks.md
Last active December 31, 2015 04:39
Makes the repository selectors in Bitbucket wider so long repository names don't get cut off. Works in Chrome or (hopefully) Firefox with Greasemonkey.

Chrome installation

  1. Click here
  2. Click OK on the warning, the file will be downloaded.
  3. Open chrome://extensions and drag the downloaded file onto the extensions page.

Firefox installation

  1. Install Greasemonkey
  2. Click here and install the script.
@jennings
jennings / web.config
Created March 11, 2014 02:50
Enable WCF message logging
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Critical,Information,ActivityTracing"
propagateActivity="true">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\inetpub\logs\messages.svclog" />
</listeners>