Skip to content

Instantly share code, notes, and snippets.

@keepitsimple
keepitsimple / gist:8178939
Last active January 1, 2016 17:39
My Ubuntu 13.10 installation script
#
sudo apt-get install ubuntu-restricted-extras
#
sudo apt-get install libavformat-extra-53 libavcodec-extra-53
# install Oracle 7 Java
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
@keepitsimple
keepitsimple / gist:9fbfd4e919315fe054b8
Created May 23, 2014 07:58
Ubuntu: view all available HDD's/partitions?
sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
@keepitsimple
keepitsimple / gist:5ae06799a802d3f0779d
Last active August 29, 2015 14:01
Add key to remote server
#generate
ssh-keygen -t rsa
#push to server
ssh user@xx.xxx.xx.xx mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "cat >> ~/.ssh/authorized_keys"
@keepitsimple
keepitsimple / post-receive
Last active August 29, 2015 14:04
Git post-receive hook on python
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#post-receive
import sys
import subprocess
# 1. Read STDIN (Format: "from_commit to_commit branch_name")
(old, new, branch) = sys.stdin.read().split()
@keepitsimple
keepitsimple / gist:e959900a79f75ae806a7
Last active August 29, 2015 14:13
Postgresql remove all entities (tables, ets) from the schema
-- drop all object in the schema
drop schema public cascade;
create schema public;
-- change owner of the schema and all objects
REASSIGN OWNED BY old_role [, ...] TO new_role
@keepitsimple
keepitsimple / gist:a4cad3d4493158d56fc4
Last active August 29, 2015 14:14
jQuery UI range slider with Knockout bindings
########################################
## RangeSlider
#
ko.bindingHandlers.rangeSlider =
init: (element, valueAccessor, allBindingsAccessor) ->
options = valueAccessor() || {}
params = allBindingsAccessor() || {}
console.log options
console.log params
@keepitsimple
keepitsimple / gist:38870eba596608c75437
Last active August 29, 2015 14:15
Knockout.js 'valueInit' binding (initialize value from html markup)
ko.bindingHandlers.valueInit =
init: (element, valueAccessor) ->
property = valueAccessor()
if !ko.isWriteableObservable(property)
throw new Error 'Knockout "valueInit" binding expects an observable.'
property element.value
#html example
#<input data-bind="value: message, valueInit: 'Hello world'" />
@keepitsimple
keepitsimple / jquery-ui-datepicker
Created February 18, 2015 10:23
jQuery UI Datepicker bindings for Knockout.js
########################################
## jQuery UI Datepicker bindings
#
ko.bindingHandlers.datepicker =
init: (element, valueAccessor, allBindingsAccessor) ->
options = allBindingsAccessor().datepickerOptions || {}
$(element).datepicker options
#/handle the field changing
ko.utils.registerEventHandler element, "change", () ->
@keepitsimple
keepitsimple / znapi.conf
Last active August 29, 2015 14:21
Upstart config file for node.js service
#znapi.conf
description "node.js zn api"
env FULL_PATH="/home/zn/app.prod"
env NODE_PATH="/usr/bin/node"
env LOG="/var/log/znapi.log"
env PIDFILE="/var/run/znapi.pid"
# Start up when the system hits any normal runlevel, and
start on filesystem or runlevel [2345]
@keepitsimple
keepitsimple / gist:a0aa7a2e10ab930d741d
Last active April 10, 2019 13:41
Ubuntu 14.04 install Xvfb
# Dependencies to make "headless" chrome/selenium work:
sudo apt-get -y install xvfb gtk2-engines-pixbuf
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
echo "Starting X virtual framebuffer (Xvfb) in background..."
Xvfb -ac :99 -screen 0 1280x1024x16 &
export DISPLAY=:99