Skip to content

Instantly share code, notes, and snippets.

@ChaosJohn
ChaosJohn / 0_reuse_code.js
Created October 20, 2013 09:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

FreeBSD 10 Nodejs setup with nginx, mongodb, redis and monit

This my receipe for installing a complete nodejs server on FreeBSD 10. The parameters used in this configuration are for a very small private server that I use for demo purpose only, so for a production server, you should somehow set the limits in pair with your ressources.

I use monit so I don't have to write rc scripts for node and it should take care of process lifecycle management for me. Alternatives exists such as supervisord or circus.

Installing mongodb

@ChaosJohn
ChaosJohn / post-receive.sh
Last active August 29, 2015 14:27 — forked from icyleaf/post-receive.sh
git autodeploy script when it matches the string "[deploy]"
#!/bin/sh
#
# git autodeploy script when it matches the string "[deploy]"
#
# @author icyleaf <[email protected]>
# @link http://icyleaf.com
# @version 0.1
#
# Usage:
# 1. put this into the post-receive hook file itself below
@ChaosJohn
ChaosJohn / README.md
Last active September 15, 2015 07:02 — forked from hwdsl2/.MOVED.md
IPsec L2TP VPN Auto Install Script for Ubuntu 14.04 & 12.04 and Debian 8
@ChaosJohn
ChaosJohn / README.md
Last active September 15, 2015 07:02 — forked from hwdsl2/.MOVED.md
IPsec L2TP VPN Auto Install Script for CentOS / RHEL 6 and 7

IPsec/L2TP VPN Auto Install Script for CentOS/RHEL

Script for automatic configuration of IPsec/L2TP VPN server on CentOS/RHEL 6 & 7 64-bit.
Works on dedicated servers or any KVM- or XEN-based Virtual Private Server (VPS).

It can also be used as the Amazon EC2 "user-data" with the official CentOS 7 AMI. Note that the official CentOS 6 AMI does NOT come with cloud-init, so you need to run this script manually after instance creation.

Alternative VPN script for Ubuntu/Debian
Original post by Thomas Sarlandie

@ChaosJohn
ChaosJohn / freebsd-java.md
Created October 9, 2015 04:16 — forked from nathggns/freebsd-java.md
Installing java on FreeBSD

Before installing this JRE, you have to install the linux binary compatibility on FreeBSD, you can follow this documentation. Jave requires some information about the proc. You have to mount linprocfs, type:

kldload linprocfs
mount -t linprocfs linprocfs /compat/linux/proc

and add this line to /etc/fstab:

linprocfs   /compat/linux/proc   linprocfs   rw   0  0
@ChaosJohn
ChaosJohn / Install Cloud9 on local or remote computer, server, or raspberry pi This gist will help you install Cloud9 on your local or remote computer, server, or even your raspberry pi. Many people are having issues at the time of this Gist's creation.
Complete installation process:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y python-software-properties python make build-essential g++ curl libssl-dev apache2-utils git libxml2-dev
sudo apt-get update
sudo apt-get upgrade
cd ~
mkdir git
cd ~/git
@ChaosJohn
ChaosJohn / arch-xhyve.sh
Created October 15, 2015 08:40 — forked from lloeki/arch-xhyve.sh
Run Arch Linux in xhyve
#!/bin/bash
tmp=$(mktemp -d)
pushd "$tmp"
iso=/Users/lloeki/Downloads/archlinux-2015.08.01-dual.iso
echo "fixing disk"
dd if=/dev/zero bs=2k count=1 of=tmp.iso
dd if=$iso bs=2k skip=1 >> tmp.iso
echo "mounting disk"
package com.az.custom.request;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
@ChaosJohn
ChaosJohn / VideoTextureView
Created November 13, 2015 11:21 — forked from garymabin/VideoTextureView
Ijkplayer video container based on TextureView
/*
* Copyright (C) 2006 The Android Open Source Project
* Copyright (C) 2012 YIXIA.COM
* Copyright (C) 2013 Zhang Rui <[email protected]>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0