Skip to content

Instantly share code, notes, and snippets.

View jstrassburg's full-sized avatar

JiM Strassburg jstrassburg

View GitHub Profile
@jstrassburg
jstrassburg / .profile
Last active August 29, 2015 14:23
OSX .profile for git branch and PS1 config
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PS1="< \w >\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
# git branch in prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Fork this file to make your customizations! For example most people don't have an Ultimate license.
# Add DS Package Store and Boxstarter packages
Set-BoxstarterConfig -NugetSources "http://choco.directs.com/nuget;http://chocolatey.org/api/v2;http://www.myget.org/F/boxstarter/api/v2"
choco sources add -name NuGet -source https://nuget.org/api/v2/
choco sources add -name DS -source http://choco.directs.com/nuget
# Windows Options
Disable-UAC
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
@jstrassburg
jstrassburg / git-remove-ignored.sh
Last active January 12, 2025 21:16
Remove files added to .gitignore but on the remote repository
git rm --cached $(git ls-files -i -c --exclude-from=.gitignore)
@jstrassburg
jstrassburg / jetBrainsIde.vmoptions
Created September 9, 2014 14:01
JetBrains IDE Anti-Aliased Fonts on Windows
-Dswing.aatext=true
-Dawt.useSystemAAFontSettings=lcd
@jstrassburg
jstrassburg / delete-branch.sh
Created June 9, 2014 16:11
Delete git branches local and remote
git branch -d branch_name # local
git push origin --delete branch_name # remote
@jstrassburg
jstrassburg / vagrant_ssh.sh
Created June 6, 2014 20:22
Use ssh instead of 'vagrant ssh' so that commands may be executed
vagrant ssh-config > ssh_config
ssh -F ssh_config default
ssh -F ssh_config default /usr/local/bin/pull-updates
@jstrassburg
jstrassburg / encode.sh
Created April 23, 2014 20:17
The worst code I ever wrote
# This was part of a larger bash script.
# I decided to use sed to replace a password in an XML file after prompting the person installing.
# Since it was XML I had to first use sed to encode for XML.
# Then, since I was using sed I had to encode for sed.
# There is some shell encoding there too because of the backticks.
# A lot of damn back slashes.
# encode for XML
# & => &amp; < => &lt; > => &gt; " => &quot; ' => &apos;
ENCODED_SQL_PASSWORD=`echo $SQL_PASSWORD | sed -e "s/&/\&amp;/g" -e "s/</\&lt;/g" -e "s/>/\&gt;/g" -e "s/\"/\&quot;/g" -e "s/'/\&apos;/g"`
@jstrassburg
jstrassburg / solrpy.py
Last active August 29, 2015 14:00
Accessing Solr with solrpy
# https://code.google.com/p/solrpy/
# Reference: http://pythonhosted.org/solrpy/reference.html
import solr
solrConnection = solr.SolrConnection(
'http://my.solr.server/solr/myCollection', http_user='basic_auth_user', http_pass='basic_auth_pass')
solrConnection.add(id=1, fieldName='something', multiValuedFieldName=['Foo', 'Bar'])
solrConnection.commit()
package com.whatever;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(value = Parameterized.class)
public class MyTest {
private String _myParameter;
@jstrassburg
jstrassburg / DeepCopyableClass.cs
Created March 30, 2014 04:41
C# deep copy pattern using the AutoMapper library
// Uses: AutoMapper
// Install via NuGet w/
// PM> Install-Package AutoMapper
using AutoMapper
public class DeepCopyableClass
{
static DeepCopyableClass()
{
// Do whatever fancy copy stuff you need here