Skip to content

Instantly share code, notes, and snippets.

@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()
@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: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;
<?php
$filePath = @$argv[1];
$outputExt = @$argv[2];
if (!isset($filePath)) {
echo "Base64 content file hasn't been actually provided";
exit;
}
@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
@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:e34abe5ab0fac72b32141a62c4496f73
Created December 24, 2016 15:38
Creating EFI System Partition for Windows
- Boot the computer using the Windows 7/8/8.1/10 installation media.
- On the first screen, press Shift+F10 to bring up the command prompt.
- Run the following commands at the command prompt.
diskpart
list disk
select disk # Note: select the disk where you want to add the EFI System partition.
list partition
select partition # Note: select the Windows OS partition (# number) or your data partition.
shrink desired=100
@mstred
mstred / gist:8e409ad84c0ad7c16e777abd7a1c5a18
Created January 22, 2018 00:42
jekyll deps for alpine... just in case
apk add --update alpine-sdk cmake libxml2-dev libxslt-dev
@mstred
mstred / gist:a1c81c68e7c1041eced07f960f043a50
Created April 20, 2018 09:51
Delete all local branches but the one checked out
alias gbrda='git branch | gsed "s/^[^*]/git branch -D/e"'
@mstred
mstred / keybase.md
Created April 29, 2018 18:36
keybase.md

Keybase proof

I hereby claim:

  • I am mstred on github.
  • I am mstred (https://keybase.io/mstred) on keybase.
  • I have a public key ASDBExZ7PjDiB1Zuvp6hcwwQVXjDKRWEXI-k2RI7mbLOxQo

To claim this, I am signing this object: