Skip to content

Instantly share code, notes, and snippets.

View keylase's full-sized avatar
💭
hmmm, status

Keylase keylase

💭
hmmm, status
  • Tashkent
View GitHub Profile
@keylase
keylase / treesize.sh
Created August 5, 2016 08:58 — forked from jesse1981/treesize.sh
Bash Script for viewing folder sizes. Just put this code into a file /bin/treesize and make it executable. Then any system user can get a list of directory sizes within a directory by just running treesize from any directory.
#/bin/sh
du -k --max-depth=1 | sort -nr | awk '
BEGIN {
split("KB,MB,GB,TB", Units, ",");
}
{
u = 1;
while ($1 >= 1024) {
$1 = $1 / 1024;
u += 1
@keylase
keylase / MONGO-PROFILING.md
Last active August 26, 2016 05:14 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@keylase
keylase / gist:f0028f21bc189a5479c9a8637cd3c706
Created September 8, 2016 11:08 — forked from clyang/gist:3231e507d90a161010a2
Multipath TCP kernel on DigitalOcean droplet (Ubuntu 14.04)
(all instruction need root permission)
0. Create a droplet with Ubuntu 14.04 image
1. wget -q -O - http://multipath-tcp.org/mptcp.gpg.key | sudo apt-key add -
2. vim /etc/apt/sources.list.d/mptcp.list , add line:
deb http://multipath-tcp.org/repos/apt/debian trusty main
3. apt-get update && apt-get install linux-mptcp
@keylase
keylase / openresty-ubuntu-install.sh
Created January 13, 2017 07:48 — forked from alex-roman/openresty-ubuntu-install.sh
Easy install openresty (used and tested on Ubuntu 14.04, 15.10 and 16.04)
#!/bin/bash
apt-get -y update
apt-get -y install nginx-extras build-essential libpcre3-dev libssl-dev libgeoip-dev libpq-dev libxslt1-dev libgd2-xpm-dev
wget -c https://openresty.org/download/openresty-1.9.15.1.tar.gz
tar zxvf openresty-1.9.15.1.tar.gz
cd openresty-1.9.15.1
./configure \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
@keylase
keylase / dump.sh
Created January 18, 2017 10:31 — forked from alanning/dump.sh
Backup script that dumps a mongo database and compresses the result. Can be run on-demand or via nightly cron job.
#!/bin/bash
# Performs a dump of target database and compresses result.
# Outputs to: $DUMPDIR/$DUMPNAME.tar.xz
# Note: Absolute paths are required for use in cron jobs
DBNAME=meteor
ROOTDIR=/Users/alanning/foo
DUMPDIR=$ROOTDIR/dumps
#!/bin/bash
inputPeriod=$1
runCommand=$2
RUN_TIME=60
RUN_TIME_LEFT=1
error="no"
SECONDS=0
if [ 'x'"$runCommand" != 'x' ]
#ubuntu 14.04
#https://habrahabr.ru/post/262563/
#https://github.com/FFmpeg/FFmpeg/commit/de2faec2faf34ee948d400101299d4ccdc1f3a50
sudo add-apt-repository ppa:graphics-drivers/ppa && sudo apt update
sudo apt-get purge nvidia-375
mkdir ffmpeg && cd ffmpeg
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz
sudo apt-get install unp
unp ffmpeg-release-64bit-static.tar.xz
cd ffmpeg-3.2.4-64bit-static/
/*
######################################################
Adobe Edge Animate to CasparCG Template Library
version 0.7.1 - 11.September.2015
by Seppo Sormunen / Pukki Visuals Oy, Finland
######################################################
E2C_Libraries.js
DO NOT MODIFY UNLESS SURE WHAT YOU ARE DOING !
SEE E2C_MAIN-x.x.x.js FILE FOR DETAILED INFO !
mptcp - ifup:
-----------------------------------
#!/bin/sh
# A script for setting up routing tables for MPTCP in the N950.
# Copy this script into /etc/network/if-up.d/
set -e
env > /etc/network/if_up_env
wget https://dl.google.com/go/go1.9.2.linux-386.tar.gz && tar -C /usr/local -xzf go1.9.2.linux-386.tar.gz