Skip to content

Instantly share code, notes, and snippets.

@daz
daz / ffmpeg-x264.sh
Last active January 29, 2021 22:26
Cross-compile ffmpeg with x264 for Raspberry Pi 2
# Build environment. I use vagrant ubuntu/trusty64
sudo apt-get install build-essential git-core
sudo git clone https://github.com/raspberrypi/tools.git /opt/tools
export CCPREFIX="/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-"
# Get ffmpeg and x264 repos
git clone git://source.ffmpeg.org/ffmpeg.git
@vincent99
vincent99 / gist:491afed2306ba448dd89
Last active February 18, 2025 09:45
Simple example of subscribing to Rancher change events
/*
Setup:
npm install ws
Usage:
Create an API key in Rancher and start up with:
node socket.js address.of.rancher:8080 access_key secret_key project_id
*/
var WebSocket = require('ws');
@maruohon
maruohon / gist:49ef39c3992316202553
Created November 11, 2014 18:13
A bash script to generate huge Minecraft worlds in several smaller parts
#!/bin/bash
#
# Author: masa
# Date: 2014-11-11
#
# A script for automatically creating (from a template), starting, stopping and running
# a command on multiple Minecraft server instances.
# The goal is to quickly generate a huge Minecraft world in a multiprocessor environment.
# The script is currently built around running 16 separate instances at once,
# and the world it will generate is 50k x 50k blocks (about, a little more since it is 100 x 100 region files).
@parente
parente / install_latest_docker.sh
Last active February 6, 2022 17:35
Install Docker latest on Ubuntu 14.04 with AUFS as the storage driver
#!/bin/bash
sudo apt-get update
sudo apt-get -y install linux-image-extra-$(uname -r)
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get -y install lxc-docker
@deian
deian / gist:f2de2f1c33580ed1b3fd
Created May 25, 2014 01:56
Using OpenPGP.JS to verify signature of a file
"use strict";
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var async = require('async');
var crypto = require('crypto');
var pgp = require('openpgp');
@sroegner
sroegner / gist:8337806
Created January 9, 2014 17:04
salt-cloud provider config example with vpc
myprovider:
provider: ec2
ssh_interface: private_ips
id: JHHJHUHLLJLKKLK>NKLL
key: 'lnjfelvehvho4of24fn2nf02[fn3ov3sfk'
private_key: /etc/salt/automation.pem
keyname: automation
securitygroupid:
- sg-abcdef12
- sg-abcdef13
@benschw
benschw / Dockerfile
Last active October 1, 2018 18:30
MySQL Docker Container
FROM ubuntu
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install mysql-client mysql-server
@plentz
plentz / nginx.conf
Last active May 3, 2025 05:27
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@tomeduarte
tomeduarte / gist:6340205
Last active August 22, 2024 14:20
Sample (and simple) NGINX configuration as a load-balancer, using SaltStack's peer communication to retrieve list of backend servers.
# /srv/salt/shared/nginx/files/sites-available/default.lb
upstream app_nodes {
# Build list of backend servers
# using peer communication as the mine is cached and slow to pick up new hosts
{% for server,ips in
salt['publish.publish'](
'G@roles:appnode',
'network.ip_addrs', expr_form='compound').items() -%}
# host: {{ server }}
{% for ip in ips -%}
@nz
nz / gist:6322673
Created August 23, 2013 18:46
Basic sketch for renaming an index in Elasticsearch
# create an index with some state (in this case, a mapping)
curl -X POST localhost:9200/test-original -d '{"mappings":{"wine":{"properties":{"designation":{"type":"string"},"full_name":{"type":"string"},"winery":{"type":"string"},"style":{"index":"no","type":"string"},"vintage":{"index":"no","type":"string"},"restaurant_ids":{"index":"no","type":"string"},"appellation":{"type":"string"},"vineyard_name":{"type":"string"},"variety_id":{"index":"no","type":"string"},"country":{"type":"string"}}}}}'
# => {"ok":true,"acknowledged":true}
# verify the mapping
curl localhost:9200/test-original/_mapping
# => {"test-original":{"wine":{"properties":{"appellation":{"type":"string"},"country":{"type":"string"},"designation":{"type":"string"},"full_name":{"type":"string"},"restaurant_ids":{"type":"string","index":"no"},"style":{"type":"string","index":"no"},"variety_id":{"type":"string","index":"no"},"vineyard_name":{"type":"string"},"vintage":{"type":"string","index":"no"},"winery":{"type":"string"}}}}}
# copy the inde