Skip to content

Instantly share code, notes, and snippets.

💭
I will be slow to respond.

Samantha Demi samdmarshall

💭
I will be slow to respond.
Block or report user

Report or block samdmarshall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View code.swift
// Intention: query a dictionary for a key-value pair, take the value as a path that needs to be expanded (tilde -> abspath)
// and then make it available to use.
let path_value = arguments["path"] ?? "" // the `?? ""` makes this a `String` and not an `Any`
var path = NSString.init(string:"\(keychain_path_value)") // this will accept an `Any` or a `String` as the type to
// subsitute when creating the `NSString` type object
if !path.isEqual(to:"") { // "if the string has contents, then expand the path"
path = path.expandingTildeInPath as NSString // cast `as NSString` is necessary because it returns a `String`
}
View installing tor on OS X.md

Install Homebrew

Installation instructions: here

Install Tor

$ brew install tor

Enabling the default config file

sudo mv /usr/local/etc/tor/torrc.sample /usr/local/etc/tor/torrc

Setup Automatic SOCKS proxy

View building_for_ios.cmake
string(REPLACE " " ";" BUILD_ARCHITECTURES $ENV{ARCHS})
set(CMAKE_OSX_ARCHITECTURES ${BUILD_ARCHITECTURES})
execute_process(COMMAND xcrun --show-sdk-path --sdk $ENV{PLATFORM_NAME} OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE CMAKE_OSX_SYSROOT)
View gist:582ef33ca1ae6f700ea2ef9723ef6ad8
+-o repo-root/
+-o android/
+-o core/
| +-o lib/
| +-o json/
| +-o json.cpp
| +-o json.hpp
| +-o test.cpp
+-o ios/
| +-o Podfile
View list comp.py
# so instead of doing this:
my_list = list()
for key in dictionary:
if dictionary[key] == 'foo':
my_list.append(key)
# you can use list comprehension to write code like this:
my_list = [key for key in dictionary if dictionary[key] == 'foo']
# both produce the same list of keys, but i think that using list comprehension is a lot more readable.
@samdmarshall
samdmarshall / # mercurial - 2016-08-16_09-12-46.txt
Created Aug 16, 2016
mercurial on Mac OS X 10.11.6 - Homebrew build logs
View # mercurial - 2016-08-16_09-12-46.txt
Homebrew build logs for mercurial on Mac OS X 10.11.6
Build date: 2016-08-16 09:12:46
View restricting_code.m
#import <Foundation/Foundation.h>
#include <mach-o/dyld.h>
uint32_t check_image(const struct mach_header *mh) {
struct mach_header *imageHeader;
uint32_t index;
for (index = 0; index < _dyld_image_count(); index++) {
imageHeader = (struct mach_header *)_dyld_get_image_header(index);
if ((int)memcmp(imageHeader, mh, sizeof(struct mach_header)) == 0) {
@samdmarshall
samdmarshall / 1. goto vs early return.c
Last active Jun 29, 2016
basic example of a goto versus an early return statement in C
View 1. goto vs early return.c
#include <stdio.h>
int add_goto(int a, int b)
{
int c;
if (a == 0) {
c = b;
goto return_statement;
}
View dsl
include "root.xcconfig"
include "codesign.xcconfig"
setting PODS_ROOT {
for * {
${SRCROOT}/Pods
}
}
View DSL
# these are some places you can put comments
include "root.xcconfig" # like here
include "codesign.xcconfig"
# or here
setting PODS_ROOT {
for * {
${SRCROOT}/Pods
}
}
You can’t perform that action at this time.