Skip to content

Instantly share code, notes, and snippets.

function unlink(file) {
return new Promise((resolve, reject) => {
file.remove(resolve, reject)
})
}
function resolveUrl(url) {
return new Promise((resolve, reject) => {
window.resolveLocalFileSystemURL(url, resolve, reject)
})
@mgax
mgax / openssl-aes.md
Last active December 9, 2015 12:39
Encrypt a stream

encrypt:

openssl aes-256-cbc

decrypt:

openssl aes-256-cbc -d
@mgax
mgax / elegant-args-list.sh
Created October 20, 2015 18:08
Clean way of writing multiple command arguments and selectively commenting them out
#!/bin/bash
set -e
args=(
echo
this
# but not this
)
@mgax
mgax / status.py
Last active October 20, 2015 18:07
Get indexing status
#!/usr/bin/env python
import subprocess
import json
from datetime import datetime
def ssh(*args, **kwargs):
user = kwargs.get('user', 'mgax')
out = subprocess.check_output(['ssh', user+'@herald'] + list(args))
return out.splitlines()
sudo apt-get install -y curl python2.7 python-virtualenv python2.7-dev build-essential postgresql-9.4 postgresql-server-dev-9.4 libxml2-dev libxslt1-dev
sudo spt-get install -y antiword poppler-utils pstotext tesseract-ocr flac lame libmad0 libsox-fmt-mp3 sox
mkdir /var/local/aleph
cd /var/local/aleph
sudo chown `whoami`: .
virtualenv venv
source venv/bin/activate
git clone https://github.com/pudo/aleph.git
cd aleph
pip install -r requirements.txt
{
"savedGeneration": [
{
"wheelCount": 2,
"wheel_radius": [
0.6898431876594318,
0.6779555255077012
],
"wheel_vertex": [
5,
@mgax
mgax / run.sh
Created September 22, 2015 09:13
#!/bin/bash
set -e
args=(
echo
hello world
)
set -x
@mgax
mgax / .gitignore
Last active September 24, 2015 16:07
Web App Boilerplate
/node_modules
/www
@mgax
mgax / reboot.sh
Created September 1, 2015 04:04
linux emergency reboot
# https://major.io/2009/01/29/linux-emergency-reboot-or-shutdown-with-magic-commands/
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

show info about volumes

megacli -LDInfo -Lall -Aall

create volume, raid0 (-r0), disk 3 ([252:3]), array 0 (-a0)

megacli -CfgLdAdd -r0 [252:3] -a0

write-through, read-ahead, don't cache if battery is down