Skip to content

Instantly share code, notes, and snippets.

View justingarrick's full-sized avatar

Justin Garrick justingarrick

View GitHub Profile
@justingarrick
justingarrick / IIS_Parallels_Win8_Mac.md
Last active March 30, 2024 16:24
Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host

Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host

Rename your virtual machine

In your Windows 7/8 VM, go to Control Panel > System > Advanced system settings > Computer Name and click Change. Name this whatever you like, e.g. windows. Restart your VM.

Add an ACL rule

Open CMD or Powershell as administrator. Add a URL ACL entry for your new name on the port of your choice, e.g.
netsh http add urlacl url=http://windows:8080/ user=everyone

Add a firewall rule

@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 / postgres.txt
Created April 22, 2014 14:05
Use PostgreSQL on OS X VM Host via Parallels Windows VM
This assumes Postgres is installed via Postgres.app
1) Setup a PGDATA environment variable in ~/.zshrc, e.g.
### PostgreSQL data
export PGDATA="/Users/justingarrick/Library/Application Support/Postgres/var-9.3"
2) In $PGDATA/postgresql.conf, add
listen_addresses = '*'
3) In $PGDATA/pg_hba.conf, add
@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>

Keybase proof

I hereby claim:

  • I am justingarrick on github.
  • I am justingarrick (https://keybase.io/justingarrick) on keybase.
  • I have a public key ASC_8zy9brmRYPOEoHnrNjfxlD26cnJLoYqlYtK1-FlZfQo

To claim this, I am signing this object:

@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 / 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
@justingarrick
justingarrick / WebAPIRawJSON.cs
Last active December 21, 2015 17:49
Read raw JSON in a WebAPI method that uses model binding
//Add
//Request.Content.ReadAsStreamAsync().ContinueWith(t => t.Result.Seek(0, SeekOrigin.Begin)).Wait();
//to your POST method, e.g.
[AntiForgeryToken]
public WeldProjectInfo Post([FromBody]RequestDetail details)
{
try
{
Request.Content.ReadAsStreamAsync().ContinueWith(t => t.Result.Seek(0, SeekOrigin.Begin)).Wait();
@justingarrick
justingarrick / generic_create.sql
Last active December 20, 2015 08:59
Generic SQL Server "create DB" script that uses the same defaults as "New Database" in SSMS. Locates data directory based on master.mdf.
USE [master]
DECLARE @dbName NVARCHAR(MAX)
SET @dbName ='Derp' -- Your DB name here
DECLARE @sql NVARCHAR(MAX)
DECLARE @template NVARCHAR(MAX)
DECLARE @dataDir NVARCHAR(MAX)
SET @dataDir = (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)
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;