Skip to content

Instantly share code, notes, and snippets.

@cornerot
cornerot / configuration.nix
Created July 25, 2022 10:54 — forked from kborling/configuration.nix
NixOS Configuration (Sway/Wayland Enabled)
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
nix = {
package = pkgs.nixUnstable;
extraOptions = ''
@cornerot
cornerot / tag-wahoo.xml
Created October 13, 2021 14:27 — forked from Intyre/1 - wahoo-create-maps.md
Wahoo create maps
<?xml version="1.0" encoding="UTF-8"?>
<tag-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" default-zoom-appear="16"
profile-name="default-profile" xmlns="http://mapsforge.org/tag-mapping"
xsi:schemaLocation="http://mapsforge.org/tag-mapping https://raw.githubusercontent.com/mapsforge/mapsforge/master/resources/tag-mapping.xsd">
<!-- ************* POIS *************** -->
<!-- HIGHWAY TAGS -->
<pois>
<osm-tag key="highway" value="mini_roundabout" zoom-appear="17" />
@cornerot
cornerot / gist:0240488a9a497285f86480686083f59c
Created June 21, 2021 15:53 — forked from nadeemsyed/gist:c89d67fe5805788b7243
Create a sample shared library in golang 1.5.
nadeem@myznc:~/go/src$ ls -al dummy
total 12
drwxrwxr-x 2 nadeem nadeem 4096 Jul 20 18:46 .
drwxrwxr-x 6 nadeem nadeem 4096 Jul 20 18:45 ..
-rw-rw-r-- 1 nadeem nadeem 129 Jul 20 18:46 hello.go
nadeem@myznc:~/go/src/dummy$ cat hello.go
// Package dummy contains hello world library.
package dummy
@cornerot
cornerot / dump.sh
Created May 13, 2020 11:14 — forked from widnyana/dump.sh
Dump Current Nginx Config
# Set pid of nginx master process here
pid=8192
# generate gdb commands from the process's memory mappings using awk
cat /proc/$pid/maps | awk '$6 !~ "^/" {split ($1,addrs,"-"); print "dump memory mem_" addrs[1] " 0x" addrs[1] " 0x" addrs[2] ;}END{print "quit"}' > gdb-commands
# use gdb with the -x option to dump these memory regions to mem_* files
gdb -p $pid -x gdb-commands
# look for some (any) nginx.conf text
@cornerot
cornerot / tailc
Created November 27, 2019 16:09 — forked from liufuyang/tailc
Color output of linux tail command
#!/bin/bash
# save this file as tailc then
# run as: $ tailc logs/supplier-matching-worker.log Words_to_highlight
file=$1
if [[ -n "$2" ]]; then
color='
// {print "\033[37m" $0 "\033[39m"}
/(WARN|WARNING)/ {print "\033[1;33m" $0 "\033[0m"}
/(ERROR|CRIT)/ {print "\033[1;31m" $0 "\033[0m"}
@cornerot
cornerot / keybase.md
Last active October 4, 2019 20:44
keybase

Keybase proof

I hereby claim:

  • I am cornerot on github.
  • I am rrom (https://keybase.io/rrom) on keybase.
  • I have a public key ASBP9mQTrZoQweS7fbDmO2h7u9SsJ_ehHiOcFOh0TA9ffgo

To claim this, I am signing this object:

@cornerot
cornerot / gist:a03861ead7e2f4845302235fe8b0fcd7
Created July 15, 2019 21:34 — forked from khakimov/gist:3558086
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@cornerot
cornerot / download-from-facecast.md
Created June 11, 2019 12:28 — forked from bigspawn/download-from-facecast.md
How download video from facecast.net
@cornerot
cornerot / zook_grow.md
Created November 26, 2018 21:42 — forked from miketheman/zook_grow.md
Adding nodes to a ZooKeeper ensemble

Adding 2 nodes to an existing 3-node ZooKeeper ensemble without losing the Quorum

Since many deployments may start out with 3 nodes and so little is known about how to grow a cluster from 3 memebrs to 5 members without losing the existing Quorum, here is an example of how this might be achieved.

In this example, all 5 nodes will be running on the same Vagrant host for the purpose of illustration, running on distinct configurations (ports and data directories) without the actual load of clients.

YMMV. Caveat usufructuarius.

Step 1: Have a healthy 3-node ensemble

@cornerot
cornerot / spectre.c
Created January 4, 2018 10:06 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif