Skip to content

Instantly share code, notes, and snippets.

@mohanpedala
mohanpedala / bash_strict_mode.md
Last active November 16, 2024 18:12
set -e, -u, -o, -x pipefail explanation
@blt
blt / lolspeed.erl
Last active December 31, 2015 04:29
-module(lolspeed).
-export([main/0]).
-define(LOLEND, 1000000).
%% > lolspeed:main().
%% = {10354,ok}
%% == {10991,ok}
%% =:= {8509,ok}
@scarytom
scarytom / remove-nodes-safely.sh
Last active May 9, 2023 20:16
Script to safely de-register jenkins nodes usage: $ remove-nodes-safely.sh my-node-1 my-node-2 my-node-3
#!/bin/bash
set -e
set -u
CI_MASTER_URL="http://ci-1"
node_online() {
curl --silent "$CI_MASTER_URL/computer/$1/api/json" | grep --silent '"temporarilyOffline":false'
}
@ericbmerritt
ericbmerritt / Makefile
Last active August 11, 2023 09:35
Universal drop in Makefile for Erlang projects that use rebar
# Copyright 2012 Erlware, LLC. All Rights Reserved.
#
# This file is provided to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 17, 2024 13:10
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'