Skip to content

Instantly share code, notes, and snippets.

@neofob
neofob / doubledecode.py
Created August 10, 2017 03:11 — forked from litchfield/doubledecode.py
Double decode utf8 and cp1252
#!/usr/bin/env python
"""
Ever had a mysqldump of utf8 data stored in latin1 tables, dumped in utf8 and
munged with windows cp1252?
If so this is your friend. Just pipe it through this little baby and spare
yourself hours of unicode hell- it'll take your dirt and spit out clean utf8.
You can also import it and use it in your python code.
@neofob
neofob / create_graphite_event.py
Created July 24, 2017 19:07 — forked from leandromoreira/create_graphite_event.py
Post event on graphite using python as a client
# more about graphite events at http://obfuscurity.com/2014/01/Graphite-Tip-A-Better-Way-to-Store-Events
import json
import requests
def create_graphite_event(event_description, tags):
required_data = "Graphite needs SSD!" # I tried withouth data attribute and it didn't work
tags_string = " ".join(str(x) for x in tags) # Since you will pass an array but graphite expects multi tags like "a,b,c" or "a b c"
event = {"what": event_description, "tags": tags_string, "data": required_data}
try:
@neofob
neofob / check-config-for-criu.sh
Created September 8, 2016 06:42 — forked from mapk0y/check-config-for-criu.sh
Check Kernel Config Script for CRIU
#!/bin/bash
: ${CONFIG:=/boot/config-$(uname -r)}
CONFIG_LIST="CONFIG_EXPERT=y
CONFIG_EMBEDDED=y
CONFIG_CHECKPOINT_RESTORE=y
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
@neofob
neofob / ken-burns.css
Created July 28, 2016 18:16 — forked from pithyless/ken-burns.css
Ken Burns effect (styling images with panning and zooming effects)
/**
* See: http://www.css-101.org/articles/ken-burns_effect/css-transition.php
*/
/**
* Styling the container (the wrapper)
*
* position is used to make this box a containing block (it becomes a reference for its absolutely positioned children). overflow will hide part of the images moving outside of the box.
*/
@neofob
neofob / ramdisk-manage
Created January 28, 2016 16:10 — forked from AutomationD/ramdisk-manage
Ramdisk persitance daemon
#!/bin/sh
# /etc/init.d/ramdisk-manage
#
case "$1" in
start)
echo "Syncing files from harddisk to ramdisk"
rsync -av /var/lib/ramdisk-persisance/ /mnt/ramdisk/
echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk Synched from HD >> /var/log/ramdisk-manage.log
;;