Skip to content

Instantly share code, notes, and snippets.

@AlexBaranowski
AlexBaranowski / huge_pages_pg_calc.sh
Created February 1, 2019 16:54
Simple script to calculate huge pages for PostgreSQL. Please note that this is baseline and require further tunning.
#!/usr/bin/env bash
[ -z "$PGDATA" ] && echo "PGDATA is not defined!" && exit 1
[ ! -e $PGDATA/postmaster.pid ] && echo "Cannot find $PGDATA/postmaster.pid is PostgreSQL server running?" && exit 1
PG_PID=$(head -1 $PGDATA/postmaster.pid)
PG_MEM_U=$(grep ^VmPeak /proc/$PG_PID/status | awk '{print $3}')
HP_MEM_U=$(grep ^Hugepagesize /proc/meminfo | awk '{print $3}')
[ "$PG_MEM_U" != "$HP_MEM_U" ] && echo "The units differ please calculate the Huge Pages manually" && exit 1
PG_MEM=$(grep ^VmPeak /proc/$PG_PID/status | awk '{print $2}')
HP_MEM=$(grep ^Hugepagesize /proc/meminfo | awk '{print $2}')
@rothgar
rothgar / tmux_local_install.sh
Last active July 23, 2024 06:59 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
TMUX_VERSION="2.1"
LIBEVENT_VERSION="2.0.20"
NCURSES_VERSION="6.0"
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
@kofemann
kofemann / tuned.conf
Last active November 1, 2023 07:44
Tuned profile for PostgreSQL server on CENTOS-7
#
# tuned configuration for PostgresSQL servers
# /usr/lib/tuned/postgres-db-server/tuned.conf
#
[cpu]
force_latency=1
governor=performance
energy_perf_bias=performance
min_perf_pct=100
@jbjornson
jbjornson / open_filename_under_cursor.py
Created September 1, 2011 13:09
Open the filename from either the current selection or the clipboard. If neither of these are files, then create a new filename based on the selection.
import sublime, sublime_plugin
import os.path, string
VALID_FILENAME_CHARS = "-_.() %s%s%s" % (string.ascii_letters, string.digits, "/:\\")
# { "keys": ["alt+o"], "command": "open_filename_under_cursor" }
# https://gist.github.com/1186126
class OpenFilenameUnderCursor(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():