Skip to content

Instantly share code, notes, and snippets.

View antonioaguilar's full-sized avatar

Antonio Aguilar antonioaguilar

View GitHub Profile
@antonioaguilar
antonioaguilar / scaleway-virtualbox-install.sh
Last active May 7, 2020 07:24 — forked from fabianmu/gist:3467a28e274f03fd9dfe20b2a6f7feca
Install Virtualbox 5.2 on Scaleway (works with Scaleway kernel 4.4.127-mainline-rev1 Ubuntu Xenial - June 2018)
alias wget='wget -q --no-check-certificate'
# so that we can install virtualbox via apt-get
for x in xenial xenial-security xenial-updates; do
egrep -qe "deb-src.* $x " /etc/apt/sources.list || echo "deb-src http://archive.ubuntu.com/ubuntu ${x} main universe" | tee -a /etc/apt/sources.list
done
echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" | tee -a /etc/apt/sources.list.d/virtualbox.list
wget https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | apt-key add -
apt-get update
FROM node
RUN mkdir -p /usr/src/app
COPY index.js /usr/src/app
EXPOSE 8080
CMD [ "node", "/usr/src/app/index" ]
@antonioaguilar
antonioaguilar / hosts.yml
Created April 17, 2018 20:42 — forked from phips/hosts.yml
Ansible setting of hostname from inventory, but ignoring IP addresses
- name: Ensure hostname set
hostname: name={{ inventory_hostname }}
when: not inventory_hostname|match('(\d{1,3}\.){3}\d{1,3}')
- name: Ensure hostname is in /etc/hosts
lineinfile:
dest=/etc/hosts
regexp="^{{ ansible_default_ipv4.address }}.+$"
line="{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}"
@antonioaguilar
antonioaguilar / kiosk-pi.txt
Created April 17, 2018 14:49 — forked from jongrover/kiosk-pi.txt
How to Kiosk Raspberry Pi
Software for the Project:
Raspbian Wheezy Debian Linux
Win32Disk Imager
The CanaKit comes with a pre-loaded SD card that includes the same version of Debian Wheezy that I used for this project. However, in an effort to get a little more speed out of the system, I used the 95MB/s Sandisk extreme listed above. It seemed to help, but I did not bench mark it beyond observation.
Anyway, lets get down to building a Raspberry Pi Web Kiosk.
Step 0: Get all of the hardware.
Step 1: Get all of the software.
@antonioaguilar
antonioaguilar / go-os-arch.md
Created April 11, 2018 15:08 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.8.3 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin
@antonioaguilar
antonioaguilar / XORCipher.js
Created April 9, 2018 09:26 — forked from sukima/XORCipher.js
A Super simple encryption cipher using XOR and Base64 in JavaScript
// XORCipher - Super simple encryption using XOR and Base64
//
// Depends on [Underscore](http://underscorejs.org/).
//
// As a warning, this is **not** a secure encryption algorythm. It uses a very
// simplistic keystore and will be easy to crack.
//
// The Base64 algorythm is a modification of the one used in phpjs.org
// * http://phpjs.org/functions/base64_encode/
// * http://phpjs.org/functions/base64_decode/
@antonioaguilar
antonioaguilar / eventemitter.js
Created April 4, 2018 13:40 — forked from mudge/eventemitter.js
A very simple EventEmitter in pure JavaScript (suitable for both node.js and browsers).
/* Polyfill indexOf. */
var indexOf;
if (typeof Array.prototype.indexOf === 'function') {
indexOf = function (haystack, needle) {
return haystack.indexOf(needle);
};
} else {
indexOf = function (haystack, needle) {
var i = 0, length = haystack.length, idx = -1, found = false;
@antonioaguilar
antonioaguilar / sysctl.conf
Created March 27, 2018 21:11 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@antonioaguilar
antonioaguilar / memusg
Created March 22, 2018 11:55 — forked from netj/memusg
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@antonioaguilar
antonioaguilar / gist:ee5b26aea38ed4f0d4aaabf5939d52c4
Created March 22, 2018 09:57 — forked from bleathem/gist:50b4dd2fd4377503eaad
Creating an Rx.js Observable from a STOMP over Websocket source (with error handling)
// see: https://github.com/jmesnil/stomp-websocket
var client = Stomp.client('ws://...');
client.debug = undefined;
var live = Rx.Observable.create(function (observer) {
console.log('Connecting...')
client.connect(username, password, function(frame) {
console.log(frame.toString());
observer.onNext(frame);