This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
socat -d -d TCP-LISTEN:5432,reuseaddr,fork TCP:$(cat /etc/resolv.conf | tail -n1 | cut -d " " -f 2):5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just a simple test to see how exception handling works in a promise. | |
function someFunc() { | |
return new Promise((fulfil, reject) => { | |
fulfil("This is from a promise"); | |
}); | |
} | |
someFunc() | |
.then(res => { | |
console.log(`Result: ${res}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Homework 1 | |
// Color to Greyscale Conversion | |
//A common way to represent color images is known as RGBA - the color | |
//is specified by how much Red, Grean and Blue is in it. | |
//The 'A' stands for Alpha and is used for transparency, it will be | |
//ignored in this homework. | |
//Each channel Red, Blue, Green and Alpha is represented by one byte. | |
//Since we are using one byte for each color there are 256 different |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pip | |
from subprocess import call | |
for dist in pip.get_installed_distributions(): | |
call("pip install --upgrade " + dist.project_name, shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script is based on the instructions presented on: | |
#http://digitaldj.net/2011/07/21/trim-enabler-for-lion/ | |
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original | |
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4D)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage | |
sudo touch /System/Library/Extensions/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.6) | |
#Create an executable called Minimal that depends on minimal.cpp. Additional source files | |
#should be space separated. | |
add_executable(Minimal minimal.cpp) | |
project(Minimal) | |
#Tell the compiler to link to the static runtime | |
add_definitions(-static) | |
#Define preprocessor macro to get boost::threads working on Windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
#include <gdiplus.h> | |
#include <memory> | |
using namespace Gdiplus; | |
using namespace std; | |
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) | |
{ |