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
@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 / 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 / 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
@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