Skip to content

Instantly share code, notes, and snippets.

🤓
nerding out on Rust

Code Monk sean9999

🤓
nerding out on Rust
Block or report user

Report or block sean9999

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sinclairtarget
sinclairtarget / bernoulli.c
Created Aug 17, 2018
Lovelace's Note G Program in C
View bernoulli.c
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
@ebidel
ebidel / feature_detect_es_modules.js
Last active Oct 16, 2019
Feature detect ES modules: both static import and dynamic import()
View feature_detect_es_modules.js
<!--
Complete feature detection for ES modules. Covers:
1. Static import: import * from './foo.js';
2. Dynamic import(): import('./foo.js').then(module => {...});
Demo: http://jsbin.com/tilisaledu/1/edit?html,output
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help.
-->
@WebReflection
WebReflection / json-channel.js
Last active Oct 14, 2018
A GJS WebKit JSON Communication Channel Example
View json-channel.js
const JSONChannel = (Private => class JSONChannel {
// (c) Andrea Giammarchi - @WebReflection (ISC)
constructor(secret=Array.from(
crypto.getRandomValues(new Uint8Array(8))
).map(i => i.toString(36)).join('')) {
const listener = e => this.emit('message', null, e.detail);
document.addEventListener(`${secret}:gjs`, listener);
Private.set(this, {
secret, listener,
fn: Object.create(null)
@gvlx
gvlx / unit.sh
Last active Oct 5, 2018 — forked from tvlooy/unit.sh
Bash test: get the directory of a script
View unit.sh
#!/bin/bash
# Following stackoverflow discussion, from https://gist.github.com/tvlooy/cbfbdb111a4ebad8b93e (rev7)
function test(){
local __MESSAGE__="$1"
local __RECEIVED__="$2"
local __EXPECTED__="$3"
if [ "${__RECEIVED__}" == "${__EXPECTED__}" ]; then
@Genovo
Genovo / strictMode.sh
Created Sep 13, 2017
Bash "Strict Mode"
View strictMode.sh
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
@jexp
jexp / neo_datatable.js
Last active Jan 30, 2017
Bookmarklet to zoom and pan Neo4j graph viz and query plans, Hold "Alt" to zoom & pan.
View neo_datatable.js
javascript: (function() {
var createTable = function() { $("neo-table > table.table.data:not(datatable)").addClass("datatable").DataTable(); };
if ($("#style-datatable").length == 0) {
$("body").append($('<link id="style-datatable" rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">'));
$.getScript('//cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js',createTable);
} else {
createTable();
}
})();
@ryzy
ryzy / haproxy.cfg
Created Mar 13, 2016
HAProxy conf with SSL termination and HTTP/2 support
View haproxy.cfg
global
#debug
chroot /var/lib/haproxy
user haproxy
group haproxy
pidfile /var/run/haproxy.pid
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
@kmassada
kmassada / README.md
Last active Feb 13, 2019
Vagrant and KVM(QEMU) on Centos7
View README.md

Libvirt

yum group install -y "Development Tools"
yum -y install qemu-kvm libvirt virt-install bridge-utils libvirt-devel  libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c
echo "net.ipv4.ip_forward = 1"|sudo tee /etc/sysctl.d/99-ipforward.conf
sysctl -p /etc/sysctl.d/99-ipforward.conf
@wunki
wunki / anonymous-gist.org
Created Oct 14, 2015
Run Ubuntu with iohyve
View anonymous-gist.org

Setup new server

  • iohyve create ubuntuguest 8G
  • iohyve set ubuntuguest loader=grub-bhyve
  • iohyve set ubuntuguest os=debian
  • iohyve set ubuntuguest ram=512M
  • iohyve set ubuntuguest cpu=2
  • iohyve set ubuntuguest con=nmdm1
  • iohyve install ubuntuguest ubuntu-14.04.3-server-amd64.iso
  • Drop in the console: iohyve console ubuntuguest
@f1sherman
f1sherman / forwarding-example.md
Last active Jul 13, 2018
Port Forwarding Example in OS X El Capitan
View forwarding-example.md

Add the following to /etc/pf.anchors/myname:

rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 4000
rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 4001

Add the following to /etc/pf-myname.conf:

rdr-anchor "forwarding"
load anchor "forwarding" from "/etc/pf.anchors/myname"
You can’t perform that action at this time.