Skip to content

Instantly share code, notes, and snippets.

@jahio
jahio / settings.json
Created September 14, 2016 14:04
Visual Studio Code - User Settings Overrides
// Place your settings in this file to overwrite the default settings
{
"editor.rulers": [80, 100],
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.mouseWheelZoom": true,
"editor.fontLigatures": true,
"editor.renderIndentGuides": true,
"editor.codeLens": true,
"diffEditor.ignoreTrimWhitespace": false,
@jahio
jahio / osx-disk-utility.md
Last active January 5, 2017 19:48
What OS X's Disk Utility SHOULD Be Able to Do - But It Got Nerfed

Notes on making USB disks from the macOS Console

Since Apple destroyed the awesome tool that was Disk Utility in the pre-Capitan days, we now have to resort to this kind of lunacy to do what used to be a simple task. Way to go, Apple. You're making Microsoft look borderline useful with these kinds of fuck-ups, and I find myself gravitating toward the power, consistency and flexibility I can get with Linux with each passing day. Get your shit together.

...anyway...

tl;dr

@jahio
jahio / .profile
Created January 3, 2017 11:05
Some useful aliases for installing and working with NixOS
#!/usr/bin/env $SHELL
alias lsblk="lsblk -o MODEL,VENDOR,NAME,LABEL,SIZE,MOUNTPOINT,FSTYPE"
alias gramps="nix-env -p /nix/var/nix/profiles/system --list-generations"
alias nixos-rebuild="nixos-rebuild -j 6 --cores 8"
#
# -j is how many "jobs" or simultaneous computational processes run in tandem
# --cores is how many CPU cores you want to use
# How do you get these values? `cat /proc/cpuinfo` and look at the number of
# returned "CPUs". They're zero indexed, so if you get the last one as object
# number seven (7), you have 8 cores.
@jahio
jahio / loginForm.html
Created May 1, 2020 00:00
Sample Component Example (Conceptual)
<div>
<input type=“text” placeholder=“Username”>
</div>
<div>
<input type=“password” placeholder=“Password”>
</div>
<div>
<input type=“submit” value=“Login”>
@jahio
jahio / start.sh
Created November 3, 2020 21:10
Start RocketMQ
#!/usr/bin/env zsh
export NAMESRV_ADDR="localhost:9876"
export ROCKETMQ_HOME="/Users/jah/Applications/rocketmq"
ORIGINAL_DIR=$(pwd)
cd $ROCKETMQ_HOME
# Purge nohup.out so we can have a fresh log for each session
if [[ -f nohup.out ]]
@jahio
jahio / stop.sh
Created November 3, 2020 21:10
Stop RocketMQ
#!/usr/bin/env zsh
export NAMESRV_ADDR="localhost:9876"
export ROCKETMQ_HOME="/Users/jah/Applications/rocketmq"
ORIGINAL_LOCATION=$(pwd)
cd $ROCKETMQ_HOME
bin/mqshutdown broker
bin/mqshutdown namesrv
@jahio
jahio / eval.yml
Created February 12, 2021 21:09
Tweed Setup File (eval.yml)
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: tweed
name: broker
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
@jahio
jahio / gist:e0fe13eae57d76a68575cdbc27a71ff8
Created November 19, 2021 19:55 — forked from vongosling/gist:9929680
Performance Tuning

Three system configuration parameters must be set to support a large number of open files and TCP connections with large bursts of messages. Changes can be made using the /etc/rc.d/rc.local or /etc/sysctl.conf script to preserve changes after reboot.

1. /proc/sys/fs/file-max: The maximum number of concurrently open files.

fs.file-max = 1000000

2. /proc/sys/net/ipv4/tcp_max_syn_backlog: Maximum number of remembered connection requests, which are still did not receive an acknowledgment from connecting client. The default value is 1024 for systems with more than 128Mb of memory, and 128 for low memory machines.

net.ipv4.tcp_max_syn_backlog = 3240000

3. /proc/sys/net/core/somaxconn: Limit of socket listen() backlog, known in userspace as SOMAXCONN. Defaults to 128.

net.core.somaxconn = 3240000

@jahio
jahio / ps.sh
Created March 31, 2022 03:27
Gimme all processes using >= 200MB rss size on STDOUT in JSON format on Linux
#!/usr/bin/env bash
# Uses `ps` from $PATH (usually /usr/bin/ps) to get processes, then filters
# those by how much rss they're using; anything lower than the amount defined
# below as $THRESHOLD is discarded. Outputs JSON to STDOUT. No arguments.
declare -a pids
declare -a cmds
declare -a rss
@jahio
jahio / ps.ps1
Created March 31, 2022 03:30
Gimme all processes using >= 200MB Working Set Size (64-bit) on...well, any OS that can run PowerShell Core (Linux, Mac, Windows)
#!/usr/bin/env pwsh
# Uses Get-Process piped to some stuff to get a list of processes
# over a certain amount of memory and output those as JSON.
# Takes no arguments.
# NOTE: This threshold is defined as BYTES, not KILOBYTES like the shell script.
# Adjust the math accordingly.
$threshold = (200 * 1024) * 1024 # Don't report anything greater than 200MB