Skip to content

Instantly share code, notes, and snippets.

/*
This is an example of a golang gzip writer program,
which appends data to a file.
*/
package main
_log_pskb(date_created,link_id,logname,log)
account(id,uid,sum)
account_attach(account_id,file_id,name,orig_name)
account_transaction(user_id,yd)
activate_service(code,email,data)
admin_log_users(user_id,log_id,last_comment_view)
annoy(ip,last_req)
articles(title,short,msgtext,sign,logo,link)
articles_comments(from_id,parent_id,from_ip,created_time,article_id,msgtext,youtube_link)
articles_comments_files(comment_id,file_id,small,inline,temp)
@cornerot
cornerot / gist:4113092514d9e4446a261ac8d51dcce5
Created December 29, 2016 12:35 — forked from tjheeta/gist:654a246d18fea65b2da0
Build OpenSSH RPM for Centos
sudo yum install -y pam-devel
sudo yum install -y rpm-build
sudo yum install -y zlib-devel
mkdir -p ~/rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz.asc
# verify the file
# update the pam ssd from the one included on the system
@cornerot
cornerot / ansible-linode-template.yml
Created August 7, 2017 13:21 — forked from vicendominguez/ansible-linode-template.yml
Ansible Linode template (tested and working)
#### CentOS: yum install pip ; pip install linode-python ; pip install chube
####
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Create linode server
linode:
api_key: '---LINODE-API-KEY-HERE---'
@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
@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 / 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 / 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 / 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 / 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