Skip to content

Instantly share code, notes, and snippets.

View mcnemesis's full-sized avatar
💭
DNAP hackathons on days with good weather ;-)

Nemesis Fixx Da JWL mcnemesis

💭
DNAP hackathons on days with good weather ;-)
View GitHub Profile
@mcnemesis
mcnemesis / responsive_html_table.html
Created October 2, 2013 15:25
An ingenious way to to hack the ultimate responsive HTML table (using Bootstrap). Instead of one monstrous TABLE, we creatively use smaller tables.
<div class="row panel"> <!-- panel class plays a big role in concealing our trick when it comes to painting the table -->
<div class="col-md-2">
<table class="table">
<thead>
<tr>
<th>CATEGORY</th>
</tr>
</thead>
<tbody>
<tr>
@mcnemesis
mcnemesis / Install_GLM.sh
Created January 28, 2014 15:11
Basic script (may not port to all *.nix systems though) to install glm (a header only lib for advanced OpenGL Mathematics) - am testing on OpenSuse 12.3
#!/usr/bin/sh
#I use axel, but you might as well use wget
#and you might wish to grab your own uri in case this one is broken...
rm glm*.zip
axel http://downloads.sourceforge.net/project/ogl-math/glm-0.9.5.1/glm-0.9.5.1.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fogl-math%2Ffiles%2F&ts=1390921576&use_mirror=garr
7z x glm*.zip && cd glm && sudo cp -r glm /usr/include/
#if all went well, you are ready to use GLM (e.g you may now proceed to ./configure-make gource :-)
Telling Exim4 to allow users on external networks to use the mail server as a relay:
So, for example your mail server has local ip:
192.168.1.1
In that case, if you only wish let you local users use the mail server to send mail, then configure the relay host as this:
In `/etc/exim4/update-exim4.conf.conf`, set the relay network to only allow local machines for example (probably filter with a Class C mask)
@mcnemesis
mcnemesis / Python_Imaging_Bug_on_Debian-711343.py
Created June 2, 2014 13:57
Highlighting some nasty bug in Python Imaging, common to Debian currently
>>> import Image
>>> Image.open("file.png")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2020, in open
raise IOError("cannot identify image file")
IOError: cannot identify image file
>>> from PIL import Image
>>> Image.open("file.png")
<PngImagePlugin.PngImageFile image mode=RGB size=40x40 at 0x25690E0>
@mcnemesis
mcnemesis / troublesomw_import_django-stdimage.py
Created June 2, 2014 14:05
The troublesome import in django-stdimage/stdimage/fields.py
try:
import Image, ImageOps
except ImportError:
from PIL import Image, ImageOps
@mcnemesis
mcnemesis / the_fix.py
Created June 2, 2014 14:13
Fixes the nasty bug!
try:
from PIL import Image, ImageOps
except ImportError:
import Image, ImageOps
@mcnemesis
mcnemesis / uganda_districts.txt
Created June 4, 2014 07:23
List of all current (as of 2014) Uganda's Districts - useful in forms-authoring and other tasks of your liking (source : http://www.statoids.com/uug.html)
Abim
Adjumani
Agago
Alebtong
Amolatar
Amudat
Amuria
Amuru
Apac
Arua
@mcnemesis
mcnemesis / trace_debug_azure_website.ps1
Created January 14, 2015 18:56
This gist shows how you can trace debug your website (e.g a php site) that's on Azure, directly from the Powershell command line.
azure account import PATH_TO_YOUR_AZURE_PUBLISH_SETTINGS_FILE
azure site log tail YOUR_AZURE_WEBSITE_NAME
@mcnemesis
mcnemesis / upgrade_wordpress_wpcli.sh
Last active August 29, 2015 14:25
This is how to upgrade your WordPress site, its plugins and themes automatically via a shell, using wp-cli
#!/bin/bash
#requires: wp-cli installed
# run all the following commands inside your wordpress root directory
wp core update #updates wp itself
wp plugin update --all #update all plugins
wp theme update -all #update all themes
- ensure to have the `~/.vim/plugin` directory
- clone the vim-autopep8 plugin git repo into your .vim:
git clone https://github.com/tell-k/vim-autopep8.git
- symlink the plugin file into your vim plugins directory
ln -s $(realpath -f vim-autopep8/ftplugin/python_autopep8.vim) plugin
- open your python file using vim