Skip to content

Instantly share code, notes, and snippets.

View GregPK's full-sized avatar

Grzegorz Kaczorek GregPK

View GitHub Profile
@GregPK
GregPK / regex-crossword-shift.js
Created August 8, 2013 11:17
Make the Regex descriptors at the top less head-turningish.
$(".crossword table thead span, .crossword table tfoot span").css({
"transform": "translate(26px, 15px) rotate(-25deg)",
"text-align": "left"
});
@GregPK
GregPK / Regex-Crossword-helper.js
Last active December 20, 2015 06:49
A helper for http://regexcrossword.com. It helps identify which patterns are not met in a non-boolean fashion. It's a spoiler, so use sparringly. Also, please note that not all situations are accounted for (empty spaces, greedy vs non-greedy matching).
window.CrossCrutch = {}
window.CrossCrutch.check = function() {
var messages = [];
$(".puzzle table tbody tr").each(function (i,e) {
var $row = $(e);
var $cols = $row.find("th,td");
var $rowHeader = $cols.filter("th");
var $other = $cols.filter("td");
@GregPK
GregPK / loadmon.sh
Created January 29, 2013 16:10
Simple load monitor for a linux machine. Gets content of /proc/avgload every 5 sec and a timestamp. usage: `./loadmon > loadmon.csv`
#!/bin/bash
while [ true ]; do
echo -n `date '+%Y-%m-%d_%H:%M:%S'` ; echo -n ' '; awk '{print date $1,$2,$3}' /proc/loadavg
sleep 5
done
@GregPK
GregPK / qStartEnd.sql
Last active December 10, 2015 23:28
Two functions that return the date of the start and end of the quarter of which the given date is in. (+some "unit tests").
DELIMITER $$
/** qStart (DATE date)
* Get the date of the start of a quarter given a date in that quarter.
*/
DROP FUNCTION IF EXISTS `qStart`$$
CREATE FUNCTION `qStart`(d DATE) RETURNS DATE
DETERMINISTIC
BEGIN
RETURN d - INTERVAL MOD(MONTH(d)-1,3) MONTH - INTERVAL DAY(d)-1 DAY;
@GregPK
GregPK / icon-maker-titanium-android
Created May 13, 2015 16:19
given an appicon.png file in the `platform/android/res` directory of the Titanium project, will generate icons with proper sizes for all devices
convert appicon.png -resize 192x192\! drawable-xxxhdpi/appicon.png && \
convert appicon.png -resize 144x144\! drawable-xxhdpi/appicon.png && \
convert appicon.png -resize 96x96\! drawable-xhdpi/appicon.png && \
convert appicon.png -resize 72x72\! drawable-hdpi/appicon.png && \
convert appicon.png -resize 48x48\! drawable-mdpi/appicon.png && \
convert appicon.png -resize 36x36\! drawable-ldpi/appicon.png
@GregPK
GregPK / gist:2768a6f952dd5aa40afd
Created October 30, 2014 11:16
Stepmania crash log (actual)
StepMania v5.0 beta 4a crash report (build 0, 20141029 @ 10:32:04 PM CET (UTC+01:00))
--------------------------------------
Architecture: Unix
Crash reason: Segmentation fault - address not mapped at 0x0000000000000004
Crashed thread: Main thread
Checkpoints:
Thread: Main thread
Profile.cpp:1626
@GregPK
GregPK / gist:5eadbae83bca4f24add6
Created October 29, 2014 21:52
Stepmania crash log
StepMania v5.0 beta 4a
Compiled 20141029 @ 10:32:04 PM CET (UTC+01:00) (build 0)
Log starting 2014-10-29 22:50:53
Xlib: extension "RANDR" missing on display ":0".
Loading window: gtk
OS: Linux ver 030500
Crash backtrace component: x86 custom backtrace
Crash lookup component: dladdr
Crash demangle component: cxa_demangle
Runtime library: glibc 2.15