Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Ilgrim / getFacebookpageposts.php
Created January 4, 2018 18:43 — forked from reducedhackers/getFacebookpageposts.php
Getting the most recent posts from a Public Page .
<?php
/*
This may be a long way around a short problem .. but
The PHP SDK from Facebook :
git clone https://github.com/facebook/php-graph-sdk.git
Im using my own FB App to give me a Token/Secret
/*
@Ilgrim
Ilgrim / .htaccess
Created January 5, 2018 13:19 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@Ilgrim
Ilgrim / nginx.conf
Created February 8, 2018 13:55 — forked from chrisallenlane/nginx.conf
This is an nginx configuration that does the following: - Implements a RESTful API using CORS between `example.com` and `api.example.com` - Uses SSL - Reverse-proxies SSL traffic from port 443 to a NodeJS application running on port 8000 Adapted from this page, with thanks to the original author: http://enable-cors.org/server_nginx.html
# Configure the reverse-proxy on port 443
server {
# general configs
keepalive_timeout 30;
listen 127.0.0.1:443 ssl;
server_name api.example.com;
# ssl configs
ssl_certificate /path/to/api.crt;
ssl_certificate_key /path/to/api.key;
@Ilgrim
Ilgrim / playwav.c
Created February 12, 2018 14:47 — forked from armornick/playwav.c
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played
@Ilgrim
Ilgrim / main.cpp
Created February 12, 2018 15:04 — forked from Twinklebear/main.cpp
Example of render to texture with SDL2
#include <iostream>
#ifdef __linux__
#include <SDL2/SDL.h>
#elif defined(_WIN32)
#include <SDL.h>
#endif
const int WIN_WIDTH = 640;
const int WIN_HEIGHT = 480;
@Ilgrim
Ilgrim / main.cpp
Created February 12, 2018 15:04 — forked from ruby0x1/main.cpp
SDL2 sample
//SDL2 flashing random color example
//Should work on iOS/Android/Mac/Windows/Linux
#include <SDL.h>
#include <SDL_opengl.h>
#include <stdlib.h> //rand()
static bool quitting = false;
static float r = 0.0f;
@Ilgrim
Ilgrim / Dockerfile
Created February 14, 2018 17:01 — forked from jumanjiman/Dockerfile
exim in a docker container
FROM alpine:3.3
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk add --no-cache exim
COPY . /
RUN /usr/sbin/harden.sh
# Volumes must be created AFTER we harden.
// world is a 2d array of integers (eg world[10][15] = 0)
// pathStart and pathEnd are arrays like [5,10]
function findPath(world, pathStart, pathEnd)
{
// shortcuts for speed
var21abs = Math.abs;
var max = Math.max;
var pow = Math.pow;
var sqrt = Math.sqrt;
@Ilgrim
Ilgrim / perlin.py
Created February 15, 2018 10:22 — forked from eevee/perlin.py
Perlin noise in Python
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
@Ilgrim
Ilgrim / perlin-noise-classical.js
Created February 15, 2018 10:35 — forked from banksean/perlin-noise-classical.js
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/