Skip to content

Instantly share code, notes, and snippets.

View alecdwm's full-sized avatar

Alec WM alecdwm

View GitHub Profile
@polonskiy
polonskiy / 10-custom.conf
Last active June 4, 2021 22:36
sysctl tuning for docker & serf
# values from https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Welcome%20to%20High%20Performance%20Computing%20%28HPC%29%20Central/page/Linux%20System%20Tuning%20Recommendations
# install (root): curl -s https://gist.githubusercontent.com/polonskiy/00a71bab32360ffcb79f/raw/10-custom.conf > /etc/sysctl.d/10-custom.conf
# apply (root): sysctl -p /etc/sysctl.d/10-custom.conf
net.ipv4.neigh.default.gc_thresh1 = 30000
net.ipv4.neigh.default.gc_thresh2 = 32000
net.ipv4.neigh.default.gc_thresh3 = 32768
net.ipv6.neigh.default.gc_thresh1 = 30000
net.ipv6.neigh.default.gc_thresh2 = 32000
@rust-play
rust-play / playground.rs
Created December 7, 2018 22:55
Code shared from the Rust Playground
type BarberId= usize;
type ShopId = usize;
struct Shop {
barber: Option<BarberId>,
}
struct Barber {
shop: Option<ShopId>,
}
@bitcoinwarrior1
bitcoinwarrior1 / substrate_get_balances_low_level.js
Last active August 18, 2021 04:16
Getting balances from a substrate node using RPC
// UPDATED THANK YOU @al3mart
util_crypto.xxhashAsHex("System", 128)
> "0x26aa394eea5630e07c48ae0c9558cef7"
util_crypto.xxhashAsHex("Account", 128)
> "0xb99d880ec681799c0cf30e8886371da9"
// https://westend.subscan.io/account/5ENpP27BrVdJTdUfY6djmcw3d3xEJ6NzSUU52CCPmGpMrdEY
util_crypto.blake2AsHex(keyring.decodeAddress("5ENpP27BrVdJTdUfY6djmcw3d3xEJ6NzSUU52CCPmGpMrdEY"), 128)
> "0xbb08f275d00049b315666c2c44130a10"
@mattrude
mattrude / markdownize_cgit.py
Created December 21, 2011 03:31 — forked from jasongraham/markdownize_cgit.py
Used by the cgit 'about-filter' to parse a markdown file.
#!/usr/bin/env python
#
# Copyright 2011, Jason Graham
#
# Uses python-markdown to convert a markdown document to the body
# of an HTML document to display with cgit (http://hjemli.net/git/cgit/).
#
# Install:
#
# 1- Install python-markdown ( sudo apt-get install python-markdown )
@jessfraz
jessfraz / j3ss.co.conf
Created October 1, 2016 21:37
nginx go-get vanity urls
server {
....
location ~ ^/x/(.*) {
if ($args = "go-get=1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="$host/x/$1 git https://github.com/jessfraz/$1.git">';
}
return 302 https://github.com/jessfraz/$1;
}
@sebastiencs
sebastiencs / volume.sh
Last active February 13, 2024 11:19
Script to get volume notification with dunst http://imgur.com/a/qWgAw
#!/bin/bash
# You can call this script like this:
# $./volume.sh up
# $./volume.sh down
# $./volume.sh mute
function get_volume {
amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
}
@quchen
quchen / trolling_haskell
Last active February 24, 2024 01:30
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
@jkullick
jkullick / headless-luks-encrypted-ubuntu-server.md
Last active March 15, 2024 21:08
Headless LUKS encrypted Ubuntu Server on Hetzner
# stop active raid
mdadm --stop /dev/md[01]

# destroy partition table on hdds
dd if=/dev/zero of=/dev/sda bs=1M count=512
dd if=/dev/zero of=/dev/sdb bs=1M count=512

# create new partition table
sgdisk -og /dev/sda
@csswizardry
csswizardry / README.md
Last active April 2, 2024 20:17
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
@bumi
bumi / yjs-pg-server.js
Created March 20, 2020 10:04
implementation of a websocket server storing yjs documents in a postgresql database
const WebSocket = require('ws');
const http = require('http');
const Y = require('yjs');
const wsUtils = require('./utils');
const cookie = require('cookie');
const QuillDelta = require('quill-delta');
//const QuillConverter = require('node-quill-converter');
//const MdastFromQuillDelta = require('mdast-util-from-quill-delta');