Skip to content

Instantly share code, notes, and snippets.

View m-2k's full-sized avatar
🌴
On vacation

Andy m-2k

🌴
On vacation
View GitHub Profile
@m-2k
m-2k / README.md
Created April 11, 2019 15:24 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@m-2k
m-2k / Install
Created February 17, 2018 22:53 — forked from jasonwryan/Install
Arch Linux installation procedure for LVM on LUKS: UEFI EFISTUB boot with gumiboot on a Samsung Series 9 laptop.
# Notes for installing on Samsung Series 9
# UEFI boot: LVM on LUKS
#
# See the full blog post:
# http://jasonwryan.com/blog/2013/01/25/uefi/
# check you are booted in uefi
modprobe efivars
ls /sys/firmware/efi/vars
@m-2k
m-2k / MySQL_macOS_Sierra.md
Created January 13, 2018 12:50 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@m-2k
m-2k / default
Created January 13, 2018 12:16 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@m-2k
m-2k / web-audio-fetch-stream.js
Created January 4, 2018 21:11 — forked from revolunet/web-audio-fetch-stream.js
Web Audio streaming with fetch API
//
// loads remote file using fetch() streams and "pipe" it to webaudio API
// remote file must have CORS enabled if on another domain
//
// mostly from http://stackoverflow.com/questions/20475982/choppy-inaudible-playback-with-chunked-audio-through-web-audio-api
//
function play(url) {
var context = new (window.AudioContext || window.webkitAudioContext)();
@m-2k
m-2k / fetch-chunked.js
Created December 28, 2017 08:16 — forked from jfsiii/fetch-chunked.js
Quick example of using fetch to parse a chunked response
var chunkedUrl = 'https://jigsaw.w3.org/HTTP/ChunkedScript';
fetch(chunkedUrl)
.then(processChunkedResponse)
.then(onChunkedResponseComplete)
.catch(onChunkedResponseError)
;
function onChunkedResponseComplete(result) {
console.log('all done!', result)
}
@m-2k
m-2k / strong-uuid.js
Created December 16, 2017 23:55
UUID (Universally Unique Identifier) Generator. Method lets you get cryptographically strong random values
// Description: fast and strong UUID generator for JavaScript
// Author: https://github.com/m-2k
// License: MIT
let uuid = () => Array.from(window.crypto.getRandomValues(new Uint8Array(16))).reduce((acc, byte, idx) => {
switch(idx) {
case 6: acc += "-4"; break
case 8: acc += "-" + ((byte & 0xF) & 0x3 | 0x8).toString(16); break
case 10: case 4: acc += "-"
default: acc += (byte & 0xF).toString(16)

Keybase proof

I hereby claim:

  • I am m-2k on github.
  • I am m2k (https://keybase.io/m2k) on keybase.
  • I have a public key ASBQ3vb7NveFw4ZbfUA1Rb_fKaQC4ydfIE7uYJTGFMhK-wo

To claim this, I am signing this object:

@m-2k
m-2k / tor-change-exitnode
Created October 1, 2017 16:09 — forked from kirelagin/tor-change-exitnode
Shell script to force Tor exit node change
#!/bin/sh
###
#
# Change Tor exit node
#
# Sometimes when using Tor you'd like to change the IP address that
# servers see when you connect (that is, change your Tor exit node).
# This happens automatically from time to time, but this shell script
# lets you force it.
#
@m-2k
m-2k / smtp_port_forwarding.md
Created September 28, 2017 21:13
Reverse SSH tunneling with iptables config for SMTP local developing

Setup NAT routing (server)

  • Setup redirecting 25 port to 2525 port for ens3 interface
iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 25 -j REDIRECT --to-port 2525
  • Show config sudo iptables -t nat -L -n -v
  • Save config sudo iptables-save