Skip to content

Instantly share code, notes, and snippets.

View matrixfox's full-sized avatar

Matrixfox matrixfox

View GitHub Profile
@matrixfox
matrixfox / xcode-6-empty-application-template.m
Last active August 29, 2015 14:10
Xcode 6 Empty Application Template
// Xcode 6 - Empty Application Template
//
// 1. Create a new "Single View Application" template.
// 2. Delete said files "Main.storyboard", "ViewController.h", "ViewController.m".
// 3. Remove the "Main storyboard file base name" entry from "Info.plist" file.
// 4. Open AppDelegate.m, and edit applicationDidFinishLaunchingWithOptions with this snippet.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- (void)viewDidLoad
{
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc]
initWithItems:[NSArray arrayWithObjects:
@"Segm 1",
@"Segm 2",
@"Segm 3",
@"Segm 4", nil]];
[segmentedControl setFrame:CGRectMake(20, 20, [UIScreen mainScreen].bounds.size.width - 40, 30)];
[segmentedControl setSelectedSegmentIndex:0];
@matrixfox
matrixfox / NSCoding
Last active August 29, 2015 14:11
NSCoding
NSCoding
===
@matrixfox
matrixfox / git-bisect.md
Last active August 29, 2015 14:11
git bisect

git bisect

  1. Binary search through revision history
  2. You may not need it often
  3. Saves a ton of time!

Commands

1. Start git bisect

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
@matrixfox
matrixfox / rapidfire.ahk
Created August 20, 2015 18:19
AutoHotkey RapidFire
#NoEnv
#SingleInstance force
SendMode Input
Numpad0::Suspend ;
Lbutton::
Loop
{
GetKeyState, state, Lbutton, P
if state=U

Using Meterpeter commands

Since the Meterpreter provides a whole new environment, we will cover some of the basic Meterpreter commands to get you started and help familiarize you with this most powerful tool. Throughout this course, almost every available Meterpreter command is covered. For those that aren’t covered, experimentation is the key to successful learning.

help

The ‘help‘ command, as may be expected, displays the Meterpreter help menu.

meterpreter > help
@matrixfox
matrixfox / gist:90728c0c834bbddf3325
Last active October 17, 2015 22:51 — forked from smazhara/gist:4740692
Ruby AES128 encrypt-decrypt example
require "openssl"
require "base64"
include Base64
plain_text = "This is the song that never ends, it goes on and on my friends."
cipher = OpenSSL::Cipher::AES128.new(:CBC)
cipher.encrypt
key = cipher.random_key
@matrixfox
matrixfox / gist:2976c823dce0c1daadff
Created October 17, 2015 23:06 — forked from RiANOl/gist:1077760
AES128 / AES256 CBC with PKCS7Padding in Ruby
require "openssl"
require "digest"
def aes128_cbc_encrypt(key, data, iv)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.iv = iv