Skip to content

Instantly share code, notes, and snippets.

View bradleyd's full-sized avatar
🏠
Working from home

Bradley D Smith bradleyd

🏠
Working from home
View GitHub Profile

Simple vsock setup for QEMU

Configuration

Host Kernel: rawhide 4.13.0-0.rc6.git4.2.fc28.x86_64 (on Fedora 24)

QEMU is mainline built from sources: QEMU emulator version 2.10.50 (v2.10.0-105-g223cd0e)

Guest: clear-17460-kvm.img (which has vsock support)

@napicella
napicella / main.go
Created February 29, 2020 17:50
Companion code for the Linux terminals blog series
// Companion code for the Linux terminals blog series: https://dev.to/napicella/linux-terminals-tty-pty-and-shell-192e
// I have simplified the code to highlight the interesting bits for the purpose of the blog post:
// - windows resizing is not addressed
// - client does not catch signals (CTRL + C, etc.) to gracefully close the tcp connection
//
// Build: go build -o remote main.go
// In one terminal run: ./remote -server
// In another terminal run: ./remote
//
// Run on multiple machines:
@lukebakken
lukebakken / README.md
Last active May 17, 2024 19:25
RabbitMQ / MQTT TCP Tuning

rabbitmq.config

[
    {rabbit, [
        {background_gc_enabled, true},
        {background_gc_target_interval, 60000},
        {tcp_listeners, [5672]},
        {num_tcp_acceptors, 10},
        {connection_max, infinity},
@zuzzas
zuzzas / debian-preseeded-iso.sh
Last active July 20, 2024 21:38
Create Debian netinstall iso with preseed file
set -e
set -u
# hat-tips:
# - http://codeghar.wordpress.com/2011/12/14/automated-customized-debian-installation-using-preseed/
# - the gist
# required packages (apt-get install)
# xorriso
@mgoodness
mgoodness / helm-rbac.md
Last active October 30, 2021 17:04
Helm RBAC setup for K8s v1.6+ (tested on minikube)
kubectl -n kube-system create sa tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
@jadeallenx
jadeallenx / discussion.md
Last active April 21, 2023 17:13
When does terminate/2 get called in a gen_server?

When does terminate/2 get called in a gen_server?

This is what the [official documentation][1] says about the terminate/2 callback for a gen_server:

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.

Reason is a term denoting the stop reason and State is the internal state of the gen_server.

Reason depends on why the gen_server is terminating. If it is because another callback function has returned a stop tuple {stop,..}, Reason will have the value specified in that tuple. If it is due to a failure, Reason is the error reason.

#!/usr/bin/env bash
# Small wrapper around the actual command used to start the daemon. This
# wrapper allows us to set various environment variables before Ruby is
# started.
#
# See the following URLs for more information on these options and their
# values:
#
# http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production
@tuxfight3r
tuxfight3r / tcp_flags.txt
Last active October 31, 2024 00:32
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@codeinthehole
codeinthehole / user-data.sh
Created August 18, 2014 12:41
Get the value of an EC2 instance's tag
#!/usr/bin/env bash
#
# Get the value of a tag for a running EC2 instance.
#
# This can be useful within bootstrapping scripts ("user-data").
#
# Note the EC3 instance needs to have an IAM role that lets it read tags. The policy
# JSON for this looks like:
#
# {
@wayetan
wayetan / RemoveNthNodeFromEndofList.java
Created December 30, 2013 08:25
Remove Nth Node From End of List
/**
* Given a linked list, remove the nth node from the end of list and return its head.
* For example,
* Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the end, the linked list becomes 1->2->3->5.
* Given n will always be valid.
* Try to do this in one pass.
*/
/**