Skip to content

Instantly share code, notes, and snippets.

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)
View ps.ps1
#!/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
jahio /
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 / gist:e0fe13eae57d76a68575cdbc27a71ff8
Created November 19, 2021 19:55 — forked from vongosling/gist:9929680
Performance Tuning
View gist:e0fe13eae57d76a68575cdbc27a71ff8


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 / eval.yml
Created February 12, 2021 21:09
Tweed Setup File (eval.yml)
View eval.yml
apiVersion: v1
kind: ServiceAccount
namespace: tweed
name: broker
kind: ClusterRole
jahio /
Created November 3, 2020 21:10
Stop RocketMQ
#!/usr/bin/env zsh
export NAMESRV_ADDR="localhost:9876"
export ROCKETMQ_HOME="/Users/jah/Applications/rocketmq"
bin/mqshutdown broker
bin/mqshutdown namesrv
jahio /
Created November 3, 2020 21:10
Start RocketMQ
#!/usr/bin/env zsh
export NAMESRV_ADDR="localhost:9876"
export ROCKETMQ_HOME="/Users/jah/Applications/rocketmq"
# Purge nohup.out so we can have a fresh log for each session
if [[ -f nohup.out ]]
jahio / sign.rb
Created September 4, 2020 11:01
Using Google Cloud Storage Signed URLs in Ruby
View sign.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'google/cloud/storage'
bucket_name = 'dygnostick-test-bucket'
file_name = 'my_file.jpg' # This is what it will be named in the bucket
exp = 20 * 60 # 20 minutes
# Instantiating a new Google::Cloud::Storage object will automatically read your
jahio / loginForm.html
Created May 1, 2020 00:00
Sample Component Example (Conceptual)
View loginForm.html
<input type=“text” placeholder=“Username”>
<input type=“password” placeholder=“Password”>
<input type=“submit” value=“Login”>
jahio / GUIDE.MD
Created December 1, 2017 05:58 — forked from darkn3rd/GUIDE.MD
Pedantic ADHD Guide to DevOps ToolBox

Pedantic ADHD Guide to DevOps ToolBox: Mac OS X Version

This is my guide to getting essential tools for DevOps on Mac OS X.

XCode Command Line Tools

You need XCode command line tools. Type git or something and run through instructions.

If you have all day to download the full Xcode IDE compiler, point Xcode command line tools to Xcode (don't ask):

jahio / .profile
Created January 3, 2017 11:05
Some useful aliases for installing and working with NixOS
View .profile
#!/usr/bin/env $SHELL
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.