Skip to content

Instantly share code, notes, and snippets.

View michaelpaul's full-sized avatar
🎯
Request changes

Michael Paul michaelpaul

🎯
Request changes
View GitHub Profile
@michaelpaul
michaelpaul / py2php.py
Created June 6, 2012 03:21 — forked from reusee/py2php.py
Python to php translator, compile python script to php
import ast
from cStringIO import StringIO
import sys
INFSTR = '1e308'
def interleave(inter, f, seq):
seq = iter(seq)
try:
f(next(seq))
@michaelpaul
michaelpaul / README.md
Last active December 15, 2016 15:33 — forked from ngauthier/README.md
Rdio "native" in linux

Testing an edit from Git

I like Rdio and linux. Rdio works great in a browser except for one thing: keyboard shortcuts!!!

When coding, I like to be able to play/pause my music quickly, meaning I don't want to switch windows. I figured out a way to do this:

Google Chrome --app

First, I made a file in my ~/bin called rdio that runs:

-- To keep the storage space for your table at a minimum, you can specify the lat and lng attributes to be floats of size (10,6). This allows the fields to store 6 digits after the decimal, plus up to 4 digits before the decimal.
CREATE TABLE `markers` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 60 ) NOT NULL ,
`address` VARCHAR( 80 ) NOT NULL ,
`lat` FLOAT( 10, 6 ) NOT NULL ,
`lng` FLOAT( 10, 6 ) NOT NULL ,
`type` VARCHAR( 30 ) NOT NULL
) ENGINE = MYISAM ;
@michaelpaul
michaelpaul / .gitignore_global
Last active October 15, 2021 09:29
My Global .gitignore
# Setup #
# git config --global core.excludesfile ~/.gitignore_global
#########
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
@michaelpaul
michaelpaul / php.dev.ini
Created January 25, 2018 10:00
My PHP dev settings
; todo error handlers, assertion
; Errors
; https://secure.php.net/manual/en/language.errors.basics.php
error_reporting=E_ALL | E_STRICT
display_errors=On
display_startup_errors=On
html_errors=Off
; Log errors
log_errors=On
@michaelpaul
michaelpaul / example.nomad
Created March 5, 2018 21:56
Nomad hello world
# There can only be a single job definition per file. This job is named
# "example" so it will create a job with the ID and Name "example".
# The "job" stanza is the top-most configuration option in the job
# specification. A job is a declarative specification of tasks that Nomad
# should run. Jobs have a globally unique name, one or many task groups, which
# are themselves collections of one or many tasks.
#
# For more information and examples on the "job" stanza, please see
# the online documentation at:
@michaelpaul
michaelpaul / query.sql
Created March 16, 2018 15:14
ON DELETE CASCADE sample
select * from gallery_item;
select * from docs;
@michaelpaul
michaelpaul / array-pointer.c
Created August 12, 2018 23:15
Using pointer as an array
#include <stdio.h>
#include <stdlib.h>
#define N 3
struct Item {
char *key;
int value;
};
@michaelpaul
michaelpaul / recursive-join.php
Created September 18, 2018 22:22
Recursive function with initializing helper
<?php
function comma($str) {
return junta($str, 1, ',');
}
function dot($str) {
return junta($str, 1, '.');
}
function junta($str, $chunk, $sep) {
if (strlen($str) <= $chunk) {
<?php
function bsearch($a, $v) {
$low = 0;
$high = count($a) - 1;
$comps = 0;
while ($low <= $high) {
$middle = $low + floor(($high-$low) / 2);
// printf("l: %d m: %d h: %d \n", $low, $middle, $high);