Skip to content

Instantly share code, notes, and snippets.

View dideler's full-sized avatar

Dennis Ideler dideler

View GitHub Profile
@dideler
dideler / 0_urllib2.py
Created June 7, 2012 11:25 — forked from kennethreitz/0_urllib2.py
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@dideler
dideler / epass.py
Created June 20, 2012 23:25
A better e-Pass for your WIB@Home account.
#!/usr/bin/env python
from sys import argv
class Epass(object):
def __init__(self):
self.table = {'A1':'?', 'B1':'?', 'C1':'?', 'D1':'?', 'E1':'?', 'F1':'?', 'G1':'?', 'H1':'?', 'I1':'?', 'J1':'?',
'A2':'?', 'B2':'?', 'C2':'?', 'D2':'?', 'E2':'?', 'F2':'?', 'G2':'?', 'H2':'?', 'I2':'?', 'J2':'?',
'A3':'?', 'B3':'?', 'C3':'?', 'D3':'?', 'E3':'?', 'F3':'?', 'G3':'?', 'H3':'?', 'I3':'?', 'J3':'?',
'A4':'?', 'B4':'?', 'C4':'?', 'D4':'?', 'E4':'?', 'F4':'?', 'G4':'?', 'H4':'?', 'I4':'?', 'J4':'?',
@dideler
dideler / python33.txt
Created July 26, 2012 21:14 — forked from hawkz/python33.txt
Python in 33 sentences
print - lets you output numbers and characters to the console.
if - let's you choose which statements are executed if an expression is true
else - denotes the statements that execute if the expression isn't true
elif - let's you combine if statements
while - is a way of repeating statements in a loop until an expression is false.
break - is a way to jump out of the statement flow of a loop.
continue - let's you skip a cycle of the flow without ending it.
for - is used to iterate over items of a collection in the order they appear in a container
@dideler
dideler / instructions.md
Created August 2, 2012 04:33
How to naturally run a program/script in Ubuntu

Symbolic Link

Use this when you don't want the actual program in a folder in your $PATH.

  1. Move folder to /usr/lib/ (optional)

     sudo mv program_directory /usr/lib
    
  2. Create a symbolic link in /usr/local/bin/

sudo ln -s /usr/lib/program_directory/program /usr/local/bin/program

@dideler
dideler / titles.md
Created August 9, 2012 07:46
IT Titles as described by Joel Spolsky

Programmer emphasizes the coding aspect of the job.

Software developer can be seen to encompass other aspects of the software creation process, such as software design, architecture, design, testing, documentation, deployment, and maintenance.

Engineer has some regional variations. In some places it implies an accredited or licensed professional. In other places (including Silicon Valley) it does not. However engineer also encompasses other technical roles in the organization such as systems administrator, network administrator, database administrator, and so forth.

Hacker adds a facet of pragmatism. A hacker, it is implied, gets things done with limited resources and leverages other work to "hack" together a working, valuable solution.

Code-monkey is insulting but is most often used in a self-deprecating way to indicate a programmer who is expected simply to write code without thinking about the larger picture (such as the code architecture or the business needs).

@dideler
dideler / pit_narrows_construct.c
Created August 18, 2012 11:53
Halo 3: Power Weapons Respawn Timer
/**
* Halo 3 Weapons Timer
* Author: Dennis Ideler
*/
#include <stdio.h>
#include <time.h>
int main()
{
@dideler
dideler / python-colours.md
Last active April 8, 2024 04:15
Formatted output in the terminal (using Python)

Most (or all) of these methods make use of ANSI escape sequences.

Straight-up

For example, using a dictionary:

ansi = {'underline': '\033[4m', 'bold': '\033[1m', 'end':'\033[0m'}
print '{[bold]}Hello World{[end]}'.format(ansi, ansi)
@dideler
dideler / unique.py
Last active April 8, 2024 04:17
Removing duplicate lines from a file in Python
#!/usr/bin/python
"""
Playing around with slightly various ways to simulate uniq in Python.
The different strategies are timed.
Only m1() and m2() do not change the order of the data.
`in` is the input file, `out*` are output files.
"""
infile = 'in' # Change filename to suit your needs.
@dideler
dideler / flipText.java
Created February 17, 2013 01:22
Flip Text - flips a line of text so that it appears to be upside-down and mirrored
/**
* Copyright 2009 Dennis Ideler
*
* $ javac flipText.java
* $ java flipText
* hello world, i'm dennis
* sıuuǝp ɯ,ı 'p1ɹoʍ o11ǝɥ
*/
import java.io.*;