Skip to content

Instantly share code, notes, and snippets.

View DanielKoehler's full-sized avatar

Daniel Arno George Koehler DanielKoehler

View GitHub Profile

Keybase proof

I hereby claim:

  • I am danielkoehler on github.
  • I am danielkoehler (https://keybase.io/danielkoehler) on keybase.
  • I have a public key ASA8HKWVRia8pacQEOJYNEuwFYDGB6f-GZZcjS1M4EbGwAo

To claim this, I am signing this object:

@DanielKoehler
DanielKoehler / import_to_require.py
Created November 28, 2016 17:22
A really horrible (but functioning) script that will try to convert ES6 style imports in a project to require() style syntax.
import re
from os import path
import click
import json
importExpression = r""".*import[ \t]+(?P<varname>[a-zA-Z0-9*_ ]+,*\s*)*({\s*(?P<module>[a-zA-Z0-9_*\s,]+)*\s*})*[ \t]+from[ \t]+(?P<br>['"])(?P<path>[a-zA-Z0-9-_\.\/]+)(?P=br).*"""
def lookahead(iterable):
# Get an iterator and pull the first value.
it = iter(iterable)

PyStorm functions

Start Motor

#ports: the ports that the motor(s) are plugged into
#power: 0-100 (how fast the mindstorm should go)
motor_start(ports, power)

# Example usage
@DanielKoehler
DanielKoehler / python - to - c#.md
Last active July 14, 2025 16:26 — forked from carols10cents/c#-to-rust.md
Python to C# Cheat Sheet

Python to C# Cheat Sheet

Variables

Python:

foo = 1
bar = "hi"
something_that_varies = 2 # Though strict immutability in Python isn't common.
@DanielKoehler
DanielKoehler / mercury-drafts.md
Last active August 29, 2015 14:25
Event dispatch wrapper for Facebook message & thread drafts creation. May be used as a way to ascertain an active Facebook thread.

Script

var originalSetItem = localStorage.setItem; 
localStorage.setItem = function(){
   
    var re = new RegExp('^mercury-drafts:([0-9]+)(root|user):([0-9]+|<([0-9]+):([0-9-]+)@mail.projektitan.com>)$');
                
 if (re.test(arguments[0])){
@DanielKoehler
DanielKoehler / gist:7f48390ea7f8b88bf9ec
Created May 17, 2015 14:55
Listing of Cardiff's available Past Papers in 2014/15
Last login: Sun May 17 15:48:57 on ttys000
Daniels-MBP-2:Past Papers danielkoehler$ cd /Users/danielkoehler/Documents/Bits and Bobs/Past Papers
Daniels-MBP-2:Past Papers danielkoehler$ tree
.
├── Archi
│   ├── 2004 - 2005 Autumn Semester
│   │   ├── AR0025 - City, Landscape And Spatial Morphology ( Sp ).pdf
│   │   ├── AR0035 - Architecture Since 1940 ( Rw ).pdf
│   │   ├── AR0040 - Issues In Contemporary Architecture ( As ).pdf
│   │   ├── AR0041 - Issues In Contemporary Architecture ( As ).pdf
@DanielKoehler
DanielKoehler / Year 2 Examination Schedule.md
Last active August 29, 2015 14:17
Cardiff University Computer Science Year 2 Examination Schedule
Module Date (Asc)
CM2303 - Algorithms And Data Structures Friday, 15 May 2015
CM2302 - Communication Networks And Pervasive Computing Tuesday, 19 May 2015
CM2203 - Informatics Friday, 22 May 2015
CM2202 - Scientific Computing And Multimedia Applications Tuesday, 26 May 2015
CM2201 - Object Oriented Applications Friday, 29 May 2015
CM2204 - Advanced Programming Wednesday, 3 June 2015
<!doctype html>
<html lang="en-GB">
<head>
<title>Google</title>
</head>
<body>
<div>
<form>
<img src="google_logo.jpeg">
<input name="search" placeholder="Search.">
+ (instancetype)singleton {
static id singletonInstance = nil;
if (!singletonInstance) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
singletonInstance = [[super allocWithZone:NULL] init];
});
}
return singletonInstance;
}