Skip to content

Instantly share code, notes, and snippets.

@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
;;
@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 / 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 / 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 / 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 / 00_OSX_Docker_Machine_Setup.md
Created October 31, 2017 18:14 — forked from bitjockey42/00_OSX_Docker_Machine_Setup.md
Use native virtualization on OS X docker with xhyve

What this?

So one of the painful points of using docker on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With xhyve, a OS X virtualization system, and docker-machine-xhyve you can now have docker use the native OS X hypervisor to run containers.

No more dealing with virtualbox shenanigans!

In this script, I've also set up a way to autoconfigure terminal sessions to load docker's environment vars (dependent on docker-machine) so you do not have to run eval $(docker-machine env whatever) every time you open a new terminal window.

Requirements

@neofob
neofob / Install NVIDIA Driver and CUDA.md
Created March 20, 2018 02:07 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@neofob
neofob / word_frequency.py
Created July 2, 2018 01:52 — forked from nmpowell/word_frequency.py
Count words in a text file, sort by frequency, and generate a histogram of the top N
#!/usr/bin/python
"""Python script to create a histogram of words in a text file.
Usage: python word_frequency.py -f "/path/to/file.txt" -n 200
Specify the path to the text file as above. Manually specify the top N words to report (default 100).
Text file can contain punctuation, new lines, etc., but special characters aren't handled well.
@neofob
neofob / gencert.sh
Created July 6, 2018 14:50 — forked from bradland/gencert.sh
Generate a self-signed SSL cert
#!/bin/bash
# Bash shell script for generating self-signed certs. Run this in a folder, as it
# generates a few files. Large portions of this script were taken from the
# following artcile:
#
# http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html
#
# Additional alterations by: Brad Landers
# Date: 2012-01-27
@neofob
neofob / mkselfssl.sh
Created July 6, 2018 14:51 — forked from adrianorsouza/mkselfssl.sh
Script to create a new self-signed SSL Certificate for Nginx
#!/bin/bash
# @author Adriano Rosa (http://adrianorosa.com)
# @date: 2014-05-13 09:43
#
# Bash Script to create a new self-signed SSL Certificate
# At the end of creating a new Certificate this script will output a few lines
# to be copied and placed into NGINX site conf
#
# USAGE: this command will ask for the certificate name and number in days it will expire