This file contains hidden or 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 org.joda.time.DateTime; | |
import javax.crypto.Mac; | |
import javax.crypto.spec.SecretKeySpec; | |
import javax.xml.bind.DatatypeConverter; | |
import java.io.UnsupportedEncodingException; | |
import java.net.URLEncoder; | |
import java.security.InvalidKeyException; | |
import java.security.NoSuchAlgorithmException; | |
import java.util.Iterator; |
This file contains hidden or 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 java.io.*; | |
import java.net.URL; | |
import java.net.URLEncoder; | |
/** | |
* @author Patrick Lorio | |
*/ | |
public class WebCache { | |
public static InputStream GetWeb(String url) throws IOException { | |
File file = new File("cache/" + URLEncoder.encode(url, "UTF-8")); |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#define call(VAR, METHOD, ...) (VAR)->METHOD(VAR, __VA_ARGS__) | |
#define with(TYPE, NAME, VALUE, BODY) {TYPE NAME = VALUE; BODY free(NAME);} | |
void flyImpl(void* rocket, int x_fore, int y_fore) { | |
printf("Applying force (%i, %i)\n", x_fore, y_fore); | |
} |
This file contains hidden or 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
CC=clang | |
FLAGS=-Wall -g | |
INCLUDE=-I./include | |
EXEC=out/program | |
SRC=$(wildcard src/*.c) | |
OBJ=$(SRC:src/%.c=obj/%.o) | |
run: setup link | |
./$(EXEC) |
This file contains hidden or 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 <stdio.h> | |
typedef struct { | |
float x; | |
float y; | |
char* name; | |
} Player; | |
typedef void (*PlayerCommand)(Player* player); |
This file contains hidden or 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
var exec = require('child_process').exec; | |
function getIp(callback) { | |
exec('wget -qO- http://ipecho.net/plain ; echo', function (error, stdout, stderror) { | |
if (error) { | |
callback(error, null); | |
return; | |
} | |
var ip = stdout.replace('\n', ''); |
This file contains hidden or 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
package audiosource; | |
import javax.sound.sampled.*; | |
import java.io.IOException; | |
import java.nio.ByteBuffer; | |
public class Listener { | |
public Listener() throws LineUnavailableException { | |
audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, sampleRate, sampleSize, | |
channels, sampleSize / 8 * channels, sampleRate, true); |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include "SDL2/SDL.h" | |
#include "SDL2/SDL_opengl.h" | |
int main(int argc, char** argv) { | |
// init | |
SDL_Init(SDL_INIT_EVERYTHING); | |
SDL_Window* window = SDL_CreateWindow("SDL2/OpenGL Demo", 0, 0, 640, 480, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE); |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <string.h> | |
// note, in binary 0x80 = [10000000], 0x7F = [011111111] | |
#define CHARS(BITS) (int)(((BITS) - (((BITS) - 1) % 8)) / 8) + 1 | |
#define BIT(DATA, POS) ((DATA[(int)((POS) / 8)] & (0x80 >> ((POS) % 8))) != 0) | |
#define SET0(DATA, POS) DATA[(int)((POS) / 8)] &= (0x7F >> ((POS) % 8) | 0x7F << (8 - ((POS) % 8))) |