Skip to content

Instantly share code, notes, and snippets.

View Tehnix's full-sized avatar
🌞
Enjoying the code...

Christian Kjær Tehnix

🌞
Enjoying the code...
View GitHub Profile
@HeinrichApfelmus
HeinrichApfelmus / GameLoop.hs
Created October 2, 2012 16:49
Game loop in reactive-banana
{------------------------------------------------------------------------------
reactive-banana
Implementation of an "industry strength" game loop with fixed time step
and variable fps.
See also http://gafferongames.com/game-physics/fix-your-timestep/
-------------------------------------------------------------------------------}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
@Tehnix
Tehnix / Notification alerts from irssi (and keeping ssh connection alive).md
Last active December 20, 2015 16:19
Get local notification alerts from irssi on a remote server, and use autossh to keep the ssh connection alive after connection loss.

Local notification alerts from irssi on a remote server (and keep the ssh connection alive after connection loss)

First of all, thanks to prebenlm for making his walkthrough Irssi in Mac OS X Notification Center.

This is made with OS X in mind, but, should be easily transported over to other systems. Just use another notification system instead of the Apple Notification center and terminal-notifier (and you'll also have to workout the auto launch of the scripts yourself)...

Programs you'll need

  1. autossh
  2. terminal-notifier
@Tehnix
Tehnix / Automatization and Media Server.md
Created August 5, 2013 23:28
Automatization and Media Server using Plex and Sick-Beard with the ThePirateBay branch from mr-orange.

Automatization and Media Server

So, recently I've been thinking about what to do with an old white Macbook I had lying around. Then I thought, what could I automate in my life that I'm doing manually now, and it struck me, I watch a lot of series. So, I started looking around for a good PVR and stumpled upon Sickbeard, but the thing is, I'm not so super happy about paying for a Usenet membership (especially since I was just playing around atm). I succeeded in finding a fork/branch that supported using torrents instead of NZB.

Torrent branch of Sickbeard

Following this forum post, since I had all the prerequisits I only needed to clone down the repo and set it up for use with Transmission (my torrent program). If you wanna autostart Sickbeard on launch and you're on OS X like me you can follow these instructions to make an

@Tehnix
Tehnix / CloudFlare API.md
Created August 5, 2013 23:34
A simple look at the cloudflare API with python.

Since we, and a lot of other people, are using CloudFlare for optimization reasons (aka, the easy way out), I thought I would take a look at their API. First thing I looked for was how to purge the cache from command line.

Now, if you don't know why I'd want to do this, let me explain. We have setup codetalk.io as a Django project, with nginx running fastcgi passing it through on localhost which Django is listening to and then responds accordingly.

Now, we usually make some changes here and there, styles and structuring. One of the things CloudFlare does for us, is cache some of our content, mainly CSS and JS. Caching, in this case, means that instead of the request coming all the way down to our server to get the file, it is picked up by CloudFlare that has set a cache time for it sparing us the load of serving it again and again (if you know varnish, they kindda act like a varnish proxy in front of us).

So, CloudFlare needs to know when we have updated our content so it can purge the cache and begin asse

@Tehnix
Tehnix / The journey to unit testing in Python.md
Created August 5, 2013 23:36
A very shallow look at unit testing in python.

With TDD (test driven development) having so much traction in our day and age, I thought it would be highly relevant to explore the concept of unit testing and such.

The idea behind test driven development, is that you first write your tests for your code, and then you write the code. This way, you can constantly watch if the code passes the tests, meaning the implementation is complete. This also forces you to think about your code before you write it, often helping you in visualizing what needs to be done and how.

A little note though, I have limited experience writing actual tests, but do know a bit about the idea/concept behind TDD.

Python gives us the lovely unittest module, which makes unit testing easy. This is, in reality, all you need to get started, but we're gonna get nose, which extends unittest to make testing easier (as is said on their site).

You can install nose via easy_install: easy_install nose

@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
#!/bin/sh
COMPUTER_NAME="tehnix"
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
@Tehnix
Tehnix / brew-up-system.sh
Last active December 7, 2023 18:55
Set up OS X with brew
#!/bin/sh
binaries=(
awscli
trash
tree
git
mosh
tmux
screen
zsh
@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@kubek2k
kubek2k / simple-binary-lambda-tutorial.md
Created December 1, 2018 22:50
Short tutorial on how to run any statically linked binary on lambda

Preamble

The introduction of Custom Runtimes has opened up new possibilities when it comes to the spectrum of languages that can be used in Amazon Lambda. This short document will show how to run virtually any statically linked binary on it. The example will cover a stack built Haskell project.

Preparations