Skip to content

Instantly share code, notes, and snippets.

View xor-gate's full-sized avatar
👽

Jerry Jacobs xor-gate

👽
View GitHub Profile
@xor-gate
xor-gate / gist:5975a645bd8772049866850a92259aac
Created June 11, 2016 14:38 — forked from r3econ/gist:9923319
Downloading JSON file using NSURLSession.
// Create a sample URL.
NSURL *url = [NSURL URLWithString:@"http://www.bbc.co.uk/tv/programmes/genres/drama/scifiandfantasy/schedules/upcoming.json"];
// Create a download task.
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
completionHandler:^(NSData *data,
NSURLResponse *response,
NSError *error)
{
if (!error)
@xor-gate
xor-gate / CMakeLists.txt
Created August 1, 2016 17:53 — forked from jcfr/CMakeLists.txt
Small project created to try to reproduce failing BigEndian test
cmake_minimum_required(VERSION 2.8.6)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Release CACHE STRING "Release configuration" FORCE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release")
endif()
project(PythonTestBigEndianIssue C)
@xor-gate
xor-gate / timespec_diff.c
Created August 2, 2016 08:29 — forked from diabloneo/timespec_diff.c
Calculate diff of two struct timespec
#include <time.h>
void timespec_diff(struct timespec *start, struct timespec *stop,
struct timespec *result)
{
if ((stop->tv_nsec - start->tv_nsec) < 0) {
result->tv_sec = stop->tv_sec - start->tv_sec - 1;
result->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000;
} else {
result->tv_sec = stop->tv_sec - start->tv_sec;
@xor-gate
xor-gate / vTag.sh
Created August 7, 2016 21:29 — forked from qvivo-tom/vTag.sh
updates your Xcode 4 info.plist with the current git tag as version and commit number
# updates your info.plist with the current git tag as version and commit number
# in that tag as build numer, then ammends the changed file to git
# run this after your normal commit but before you push
#
# this to be placed in the same directory as the xcode project file
# info.plist to be in the path [folder with projectfile]/[project name]/[project name]-Info.plist
#
# richy486@gmail.com
# twitter.com/richy486
@xor-gate
xor-gate / xcode-build-bump.sh
Created August 9, 2016 11:01 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@xor-gate
xor-gate / portable_endian.h
Created September 8, 2016 22:16 — forked from panzi/portable_endian.h
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, and Mac OS X. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put "port…
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@xor-gate
xor-gate / Makefile
Created September 22, 2016 14:40 — forked from mgalgs/Makefile
ELF section hacking!
all: section_hacking
section_hacking:
gcc -g -O0 -Werror -Wall -o section_hacking section_hacking.c plugin.c
clean:
rm -f *.o section_hacking

KVM OSX Guest 10.11 (El Capitan) with Clover

  • Some notes about this approach:
    • An OSX Installer USB drive for Install OS X El Capitan is created
    • Clover is then installed on the USB drive
    • Clover Configurator is then run on the USB drive
    • The USB drive contents are copied to the VM host
    • VNC is used to connect to the guest UI
  • The qxl virtual video device is used (part of the standard kvm qemu install)
@xor-gate
xor-gate / 0_MEMO.md
Created November 24, 2016 13:12 — forked from t-yuki/0_MEMO.md
Example gocov-xml Jenkins job with cobertura plugin for gocov project. You should edit GOROOT and GOPATH and remove `go get xxx`.

Points:

  1. Checkout git repository to subdir src/gocov using Local subdirectory for repo option of Jenkins Git Plugin.
  2. Add Jenkins $WORKSPACE to $GOPATH
  3. Convert gocov output. absolute path to relative path.
mkdir -p $JENKINS_HOME/gopath
export GOROOT=$JENKINS_HOME/workspace/golang
export GOPATH=$JENKINS_HOME/gopath:$WORKSPACE
@xor-gate
xor-gate / keys.go
Created January 28, 2017 15:06 — forked from sdorra/keys.go
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"