Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ninjacato on github.
  • I am catoauestad (https://keybase.io/catoauestad) on keybase.
  • I have a public key ASD2Znj3trPvp1sklYKpiccgWOcwXJIm9h4oGOvWX8iIJgo

To claim this, I am signing this object:

@ninjacato
ninjacato / PHP72_Add_PDO_Close.patch
Created May 31, 2018 09:21
Add $pdo->close() function to kill the database connection
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 4a372a9c18..0982555b7e 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -973,6 +973,31 @@ static PHP_METHOD(PDO, lastInsertId)
}
/* }}} */
+/* {{{ proto bool PDO::close()
+ Close the database connection */
@ninjacato
ninjacato / DS18B20_CHIP.py
Created December 31, 2016 18:35
Super-hacky DS18B20 C.H.I.P to Dweet.io/Freeboard.io Python script (DISCLAIMER: This piece of shit code does not represent me or my company, promises precious!)
#!/usr/bin/python3
import requests
lines = [line.rstrip('\n') for line in open('/sys/devices/w1_bus_master1/28-041623a503ff/w1_slave')] # Replace with own device
crc = lines[0].endswith('YES')
# Insert precision
temp = lines[1][29:][:2] + "." + lines[1][29:][2:]
@ninjacato
ninjacato / Xresources
Created October 7, 2015 10:38
My Xresouces theme
xterm.*backarrowKey: false
*xterm*foreground: #f0e9dc
*xterm*background: #3e3e3e
*xterm*cursorColor: #f0e9dc
*xterm*color0: #3e3e3e
*xterm*color8: #5d5d5d
*xterm*color1: #966575
*xterm*color9: #cf8ba2
*xterm*color2: #659675
*xterm*color10: #90d6a6
@ninjacato
ninjacato / cato_dwm_conf.patch
Last active October 30, 2015 07:06
My dwm and surf configurations
diff --git a/config.h_old b/config.h
index 77ff358..98c1c65 100644
--- a/config.h_old
+++ b/config.h
@@ -5,8 +5,8 @@ static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*
static const char normbordercolor[] = "#444444";
static const char normbgcolor[] = "#222222";
static const char normfgcolor[] = "#bbbbbb";
-static const char selbordercolor[] = "#005577";
-static const char selbgcolor[] = "#005577";
var App = angular.module('myModuleName', ['ngCookies']);
function SomeFunc($scope, $cookies) {
$cookies.NameOfMyCookie = "Setting a value";
alert($cookies.NameOfMyCookie);
}