Skip to content

Instantly share code, notes, and snippets.

View KevinMGranger's full-sized avatar

Kevin M Granger KevinMGranger

View GitHub Profile
@KevinMGranger
KevinMGranger / counter.c
Created April 20, 2017 17:26
c_1_16_loop
// cc counter.c -o counter && ./counter
#include <stdio.h>
int get_1();
int get_2();
int get_3();
int get_4();
int get_5();
int get_6();
int get_7();
#!/usr/bin/env bash
sudo timedatectl set-time $(date -I) 01:00
sleep_amounts=(IGNORE 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20)
while :; do
hr=$(date +%H)
echo $hr
sleep "${sleep_amounts[$hr]}h"
@KevinMGranger
KevinMGranger / different.py
Created August 10, 2016 19:46
lambda versus functions
def one():
print(1)
two = lambda: print(2)
import dis
dis.dis(one)
2 0 LOAD_GLOBAL 0 (print)
3 LOAD_CONST 1 (1)
6 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
9 POP_TOP
@KevinMGranger
KevinMGranger / gist:97948b97f778565a5ba2
Last active August 29, 2015 14:07
Doctrine DQL Issue
try {
$dql = <<<EOF
SELECT u, emailCfg
FROM Entities\Financial\transaction tract
LEFT JOIN tract.user u
LEFT JOIN u.emailConfiguration emailCfg
WHERE tract.id IN (?1)
EOF;
$query = $em->createQuery($dql);
@KevinMGranger
KevinMGranger / contact.php
Created September 25, 2014 13:06
Issues with doctrine embeddables
<?php
/**
* @Embeddable
*/
class DoctrineContact implements Contact
{
/**
* @Column(name="ContactName")
*/
@KevinMGranger
KevinMGranger / gist:0ad0c0fc7434091fa7e8
Last active August 29, 2015 14:06
Salt State Example
{% if grains['os.family'] == 'Arch' %}
composer:
pkg.installed
{% else %}
get-composer:
cmd.run:
- name: 'CURL=`which curl`; $CURL -sS https://getcomposer.org/installer | php'
- unless: test -f /usr/local/bin/composer
- cwd: /root/
#!/bin/bash
#plays videos in framebuffer
mplayer -vo fbdev -really-quiet