Skip to content

Instantly share code, notes, and snippets.

View justingarrick's full-sized avatar

Justin Garrick justingarrick

View GitHub Profile
@justingarrick
justingarrick / sqllocks.sql
Last active October 4, 2015 05:48
Kill Stubborn SQL Server DB Locks
SELECT L.request_session_id AS SPID,
DB_NAME(L.resource_database_id) AS DatabaseName,
O.Name AS LockedObjectName,
P.object_id AS LockedObjectId,
L.resource_type AS LockedResource,
L.request_mode AS LockType,
ST.text AS SqlStatementText,
ES.login_name AS LoginName,
ES.host_name AS HostName,
TST.is_user_transaction as IsUserTransaction,
@justingarrick
justingarrick / remotedata.sql
Last active October 4, 2015 05:48
Find Data Directory of Remote SQL Server Instance
SELECT SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)
FROM master.sys.master_files
WHERE database_id = 1 AND file_id = 1
@justingarrick
justingarrick / eclipse.ini
Last active May 22, 2023 04:48
eclipse.ini settings for Eclipse Indigo/Juno/Kepler & JDK7
-nosplash
--launcher.defaultAction
openFile
-vm
C:/JDK7/jre/bin/server/jvm.dll #Windows
#/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java #OS X
-vmargs
-Xincgc
-Xss1m
-Duser.name=FirstName LastName
@justingarrick
justingarrick / youtube.sh
Last active October 4, 2015 05:57
Youtube Bookmarks -> MP3
# !/bin/bash
# Justin Garrick
# Put this script in a folder with get_flash_videos (http://code.google.com/p/get-flash-videos/)
# and your bookmarks.html file and run it
# This does no error checking/handling -- if a video cannot be found, it just won't be grabbed
# Grabs the urls from all bookmarks containing youtube in the url
for URL in `grep -i "<a href=.*youtube.*" bookmarks.html | cut -d '"' -f 2`; do
echo "Downloading ${URL}..."
# Download video as high quality mp4 if possible
@justingarrick
justingarrick / pppoe.sh
Last active October 4, 2015 05:57
PPPoE DSL Modem Passthrough with Tomato
# Assuming modem is a Motorola 2210-02-1006 running in bridge mode w/ a LAN IP of 192.168.1.254
# Router is WRT54G running Tomato w/ LAN IP of 192.168.2.1 and is handling PPPoE
# In order to access modem's web UI via LAN:
# 1) Add the following script under Administration > Scripts > Init:
sleep 5
ip addr add 192.168.1.2/24 dev vlan1 brd +
iptables -I POSTROUTING -t nat -o vlan1 -d 192.168.1.0/24 -j MASQUERADE
# 2) Add the following script under Administration > Scripts > Firewall:
iptables -I POSTROUTING -t nat -o vlan1 -d 192.168.1.0/24 -j MASQUERADE
@justingarrick
justingarrick / opengrok.txt
Last active September 19, 2018 06:18
Setup OpenGrok on Tomcat (/w LDAP) to Search SVN
These instructions are an amalgamation of those posted at http://jdevel.wordpress.com/2011/03/26/running-opengrok-on-windows/ and my own experience.
To setup OpenGrok on Windows running under Tomcat:
1. Download OpenGrok binary. Just go to OpenGrok Home and download the latest (0.10, currently) binary
2. Download ctags. Just go to ctags, download windows zip file and extract it somewhere.
3. Edit web.xml. You need to extract lib/source.war somewhere and modify WEB-INF/web.xml slightly. I’ve modified the CONFIGURATION param to point to my generated configuration.xml file(more about it later) and added SRC_ROOT and DATA_ROOT to point to folder with sources to index and folder that OpenGrok should keep it’s data in (I’m not sure if these two are needed if you pass in configuration.xml)
<context-param>
<param-name>CONFIGURATION</param-name>
<param-value>D:/GrokTest/configuration.xml</param-value>
@justingarrick
justingarrick / visitor.rb
Last active December 24, 2017 11:23
Visit a webpage X times with a random user-agent via a randomly chosen proxy server. A decent proxy list can be downloaded from http://www.proxynova.com/proxy_list.txt, but this is not scripted because the site frequently goes down.
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
class Visitor
def initialize(proxy_file, url, iterations)
@proxy_file = proxy_file
@url = url
@iterations = iterations
end
@justingarrick
justingarrick / d2dreamstack.au3
Last active December 12, 2015 03:58
AutoIt3 script for aura stacking a paladin in D2. No idea if this still works, archiving it here.
HotKeySet("{DEL}", "stop")
Opt("MouseCoordMode", 0)
$i = 0
$i2 = 0
WinActivate("Diablo II")
WinWaitActive("Diablo II")
Do
$i = $i + 1
@justingarrick
justingarrick / osx_j7_eclipse_setup.txt
Last active September 7, 2016 16:00
OS X Java7 & Eclipse Setup
1.* Delete all traces of Java 6. Look under /Library/Java/JavaVirtualMachines and /System/Library/Java/JavaVirtualMachines
2. Install JDK7 via the .dmg from Oracle, it should install to /Library/Java/JavaVirtualMachines
3. Symlink JDK7 to JDK6 to "trick" OS X into thinking we have Java 6 installed for applications that require it:
$ sudo mkdir /System/Library/Java/JavaVirtualMachines
$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
4.** Set JAVA_HOME. You can't just set this in your ~/.bashenv or ~/.zshenv files, because the m2e plugin in Eclipse isn't aware of those unless you start Eclipse from the command line. You need to add it to /etc/launchd.conf:
$ sudo touch /etc/launchd.conf
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using MyProject.Domain;
using EO.Pdf;
using EO.Pdf.Acm;