Skip to content

Instantly share code, notes, and snippets.

@mstred
mstred / gist:41f137007e00068a97585e2264ba30b7
Created December 23, 2016 21:20
Cleaning up pg_xlogs in a postgres' docker container
docker exec -it <postgres container> su -c "rm /var/lib/postgresql/data/postmaster.pid && /usr/lib/postgresql/<version>/bin/pg_resetxlog -f /var/lib/postgresql/data" postgres
@mstred
mstred / gist:ff5d5996c8e19963294eeccd2f62fee3
Last active November 18, 2016 01:20
Windows 10 (build 14393) en-US LP/MUI
Windows 10 Single Language en-US Language Pack (build 14393)
http://download.windowsupdate.com/c/msdownload/update/software/updt/2016/07/lp_6cb8e04b938b9c8b20221317db1f5b381ef00531.cab
<?php
$filePath = @$argv[1];
$outputExt = @$argv[2];
if (!isset($filePath)) {
echo "Base64 content file hasn't been actually provided";
exit;
}
@mstred
mstred / gist:66f1831e1a46521b9d67
Last active August 29, 2015 14:11
JS sketches
/*
* A little bit of fun with JS
*/
(function() {
var a = new Object();
var b = undefined;
var c = "asd";
var d = 123;
@mstred
mstred / gist:f669d9134bce8c1ce3b8
Last active August 29, 2015 14:10
Keyboard Fix

Such a neat fix for the trippy involuntary keyboard changes on Ubuntu 14.04 (Trusty Tahr)

$ setxkbmap -layout br,us
@mstred
mstred / gist:5172606
Created March 15, 2013 19:49
Content file to Data-URI file generator in Groovy
def path = "" //path to input file directory
def input = new File("${path}/file.png") //example
def mime = new javax.activation.MimetypesFileTypeMap().getContentType(input)
def content = "data:${mime};base64,${input.bytes.encodeBase64().toString()}"
def output = new java.io.FileWriter("${path}/${input.name}.datauri")
def info = "${input.name} -> ${((input.size() / 1024f) / 1024f)} MB \nMime-type: ${mime}"
println info
output.write(content)
output.close()