Skip to content

Instantly share code, notes, and snippets.

DreamPiggy dreampiggy

Block or report user

Report or block dreampiggy

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
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 / Game.exe.manifest
Created Jul 26, 2016
Fix High DPI resolution and blur screen issue in Windows 8/8.1/10 for legacy D3D game and Win32 application.
View Game.exe.manifest
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<dpiAware xmlns="">true</dpiAware>
dreampiggy / thunder
Last active Jul 19, 2016
Thunder Xware boot service for Raspberry Pi or NAS
View thunder
#! /bin/sh
# /etc/init.d/thunder
# Provides: thunder
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Thunder Server at boot time
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 / QuickSort.m
Created Jun 17, 2016
View QuickSort.m
void quicksortInPlace(NSMutableArray *array, NSInteger first, NSInteger last, NSComparator comparator) {
if (first >= last) return;
id pivot = array[(first + last) / 2];
NSInteger left = first;
NSInteger right = last;
while (left <= right) {
while (comparator(array[left], pivot) == NSOrderedAscending)
while (comparator(array[right], pivot) == NSOrderedDescending)
public class Singleton {
private volatile static Singleton singleton;
private Singleton (){}
public static Singleton getSingleton() {
if (singleton == null) {
synchronized (Singleton.class) {
if (singleton == null) {
singleton = new Singleton();
dreampiggy /
Created May 26, 2016
Counter-Strike Global Offensive OS X Boost
CSGO_ID=`ps aux | grep csgo_osx64 | grep -v grep | awk '{print $2}'`
if [ -n "$CSGO_ID" ]; then
$(echo $ROOT_PWD | sudo -S renice -20 -p $CSGO_ID >/dev/null 2>&1)
echo "CSGO Boost Success"
echo "CSGO Boost Fail"
dreampiggy / Clone.js
Last active Jun 14, 2016
Clone object in JavaScript
View Clone.js
'use strict';
function clone(obj) {
if (obj == null || typeof obj != "Object") {
return obj;
let copy = obj.constructor();
for (let attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = obj[attr];
You can’t perform that action at this time.