Skip to content

Instantly share code, notes, and snippets.

View kanatzidis's full-sized avatar

Gregori Kanatzidis kanatzidis

View GitHub Profile
@kanatzidis
kanatzidis / How To Tell If You Are In An H.P. Lovecraft Story.md
Last active August 29, 2015 14:04
How To Tell If You Are In An H.P. Lovecraft Story

How To Tell If You Are In An H.P. Lovecraft Story

It takes you centuries to discover you are dead.

After reading a book, all the forces of an unknowable maddening god bear down upon you. This condition is hereditary.

You frequently fail to pronounce, describe, or name anything significant in your life.

You are on a desolate rock. Geometry has taken an active dislike to you.

@kanatzidis
kanatzidis / bubble_sort.lisp
Last active August 29, 2015 14:04
Bubble sort without side effects (an embarrassingly bad way of doing it)
(defun my-bubble (lst)
(or (not lst)
(let ((ret nil) (iter nil) (small (reduce (lambda (x y) (min x y)) lst)))
(dolist (obj lst)
(if (not (eql obj small))
(setf iter (cons obj iter))
(setf ret (append ret (cons obj nil)))))
(append ret (let ((a (my-bubble iter))) (and (listp a) a))))))
(my-bubble '(1 4 3 8 2 9))
@kanatzidis
kanatzidis / bubblesort_malloc.c
Last active August 29, 2015 14:16
Simple C bubblesort implementation
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int* bubble(int array[], size_t size);
int main(void)
{
int i;
FROM centos:centos6
# Enable EPEL for Node.js
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# Install Node.js and npm
RUN yum install -y npm
# Bundle app source
COPY . /src
# Install app dependencies
@kanatzidis
kanatzidis / pushstate.nginxconf
Created April 3, 2016 19:19 — forked from aotimme/pushstate.nginxconf
Nginx config file to support pushState.
# pushState friendly!
# The setup:
# * website name is `site.com`
# * the API for your running on localhost:3000
# * the root for API calls is at `/api`, and you have authentication routes with root `/auth` (both go to localhost:3000)
# * javascript app is located at `/path/to/javascript/app`
# Assuming you have your server for API calls at localhost port 3000
upstream api_sitecom {
server localhost:3000;

Keybase proof

I hereby claim:

  • I am kanatzidis on github.
  • I am kanatzidis (https://keybase.io/kanatzidis) on keybase.
  • I have a public key ASB1lKWzHa_c2RUs2Oj3c51T1lUfxm7B2iwT1bZdCWEtYAo

To claim this, I am signing this object:

#!/usr/bin/env bash
# set env vars from within ec2 instance
EC2_AVAIL_ZONE=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
  apt-get update &&\
    apt-get install -y libgtk2.0-0 libgconf-2-4 \
    libasound2 libxtst6 libxss1 libnss3 xvfb
  
  Xvfb -ac -screen scrn 1280x2000x24 :9.0 &
  export DISPLAY=:9.0

From segment-boneyard/nightmare#224 (comment)

@kanatzidis
kanatzidis / alias.cmd
Created January 14, 2017 17:38 — forked from benjamine/alias.cmd
Aliases for windows command line
::
:: Aliases for windows command line
::
:: Installation:
::
:: - create a folder for your aliases (eg: ```c:\cmd-aliases```)
:: - add that folder to your PATH variable
:: - save this script as setalias.cmd on that folder
:: - run "alias" to see usage
::
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
Also put this (without sudo) in /etc/rc.local to run on reboot