Skip to content

Instantly share code, notes, and snippets.


DreamPiggy dreampiggy

View GitHub Profile
dreampiggy /
Created Oct 22, 2019 — forked from subfuzion/
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

View decode-dyn-uti.swift
extension String
/// Creates a string by decoding a sequence of UTF-8 code units.
init?<S: Sequence>(utf8 input: S) where S.Iterator.Element == UTF8.CodeUnit {
var chars: [Character] = []
var decoder = UTF8()
var iter = input.makeIterator()
loop: while true {
switch decoder.decode(&iter) {
case .scalarValue(let scalar): chars.append(Character(scalar))
dreampiggy / cli-nsrunloop.m
Created Mar 29, 2019 — forked from syzdek/cli-nsrunloop.m
Creating an NSRunLoop for a command line utility.
View cli-nsrunloop.m
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
NSRunLoop * runLoop;
CLIMain * main; // replace with desired class
// create run loop
View PSPDFFastEnumeration.h
// PSPDFFastEnumeration.h
// PSPDFFoundation
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps:
// Try it today using our free PDF Viewer app:
// This file is MIT licensed.
@protocol PSPDFFastEnumeration <NSFastEnumeration>
dreampiggy / linkmap.js
Created Nov 28, 2016 — forked from bang590/linkmap.js
XCode Linkmap Parser
View linkmap.js
var readline = require('readline'),
fs = require('fs');
var LinkMap = function(filePath) {
this.files = []
this.filePath = filePath
LinkMap.prototype = {
start: function(cb) {
dreampiggy / SpinlockTestTests.swift
Created Oct 19, 2016 — forked from steipete/SpinlockTestTests.swift
Updated for Xcode 8, Swift 3; added os_unfair_lock
View SpinlockTestTests.swift
// SpinlockTestTests.swift
// SpinlockTestTests
// Created by Peter Steinberger on 04/10/2016.
// Copyright © 2016 PSPDFKit GmbH. All rights reserved.
import XCTest
dreampiggy / .wakeup
Created Aug 11, 2016 — forked from ralph089/.wakeup
Restarts Bluetooth Module on Mac OS X El Capitan. You can use the script as shortcut to restart Bluetooth on demand or you can use it with "SleepWatcher" to automatically restart Bluetooth on wakeup (See I created it, because my Logitech Bluetooth Mouse doesn't stay connected after sleep-mode, so i had to manually re-pair my mouse.
View .wakeup
# Restart Bluetooth Module on Mac OS X
# Requires Blueutil to be installed:
log() {
echo "$@"
dreampiggy /
Created Jul 19, 2016 — forked from naholyr/
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.


Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
dreampiggy /
Created Jul 2, 2016 — forked from ericclemmons/
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

 <summary>Summary Goes Here</summary>
dreampiggy / 0_reuse_code.js
Created Mar 14, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console