Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View justingarrick's full-sized avatar

Justin Garrick justingarrick

View GitHub Profile

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 / Demangle Swift.py
Created October 5, 2015 13:20 — forked from steventroughtonsmith/Demangle Swift.py
Hopper Swift demangler
import subprocess
def looksLikeBeginning(doc,seg,adr):
if doc.is64Bits() and seg.readByte(adr) == 0x55 and seg.readByte(adr + 1) == 0x48 and seg.readByte(adr + 2) == 0x89 and seg.readByte(adr + 3) == 0xE5:
return True
if not doc.is64Bits() and seg.readByte(adr) == 0x55 and seg.readByte(adr + 1) == 0x89 and seg.readByte(adr + 2) == 0xE5:
return True
return False
doc = Document.getCurrentDocument()
@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 / fix.txt
Last active August 29, 2015 13:57
Fix Fatal Signal 11 when Google Analytics/Picasso is used with Retrofit/OkHttp
Create a method like the following:
/**
* Fix https://github.com/square/okhttp/issues/184
*
* @return an unfucked OkHttpClient for use with a RestAdapter
*/
public static OkClient createClient() {
OkHttpClient client = new OkHttpClient();
SSLContext sslContext;
@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 / 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 / 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;
@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 / 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