Skip to content

Instantly share code, notes, and snippets.

@diogoleal
diogoleal / gist:3045996a417ddb940bd582740d4f46b5
Created February 6, 2023 12:25 — forked from Khoulaiz/gist:41b387883a208d6e914b
Checking ports without telnet

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
autoload -Uz compinit
compinit
CASE_SENSITIVE="false"
HISTSIZE=10000
HISTFILE=~/.zsh_history
SAVEHIST=10000
autoload -U promptinit; promptinit

Keybase proof

I hereby claim:

  • I am diogoleal on github.
  • I am diogoleal (https://keybase.io/diogoleal) on keybase.
  • I have a public key whose fingerprint is 4265 C84A D88B 6B22 E101 0FC0 866C 4A5E 4D7C F362

To claim this, I am signing this object:

@diogoleal
diogoleal / pev.spec
Created August 24, 2015 10:35
pev.spec
Name: pev
Version: 0.70
Release: 1
License: GPL3
URL: http://pev.sf.net/
Requires: readline
BuildRequires: pcre-devel openssl-devel
Source0: http://nbtelecom.dl.sourceforge.net/project/pev/pev-%{version}/pev-%{version}.tar.gz
Summary: The PE file analysis toolkit
@diogoleal
diogoleal / template
Created August 19, 2015 13:11
boswar template
# Template file for 'boswars'
pkgname=boswars
version=2.7
revision=1
wrksrc=${pkgname}-${version}-src/
makedepends="lua51-devel libtheora-devel libogg-devel libpng-devel SDL-devel libvorbis-devel libX11-devel MesaLib-devel scons libpng-progs pkg-config libGL"
depends="libtheora libogg libpng libvorbis"
short_desc="A futuristic real-time strategy game (RTS)"
maintainer="Diogo Leal <diogo@diogoleal.com>"
license="GPL-2"
! xterm color scheme — Make all 16 beautiful.
!
! Suited for black background, but includes disabled alternative light scheme.
!
! Open this file with gvim to enable <Leader><F2> color mode.
!
! Use `xfontsel`, `xlsfonts`, and `fc-list` to find other fonts.
!
! On Ubuntu I have to name this file ‘~/.Xdefaults-$(hostname)’
!

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
BOX_NAME=vagrant-build
BASE_DIR="`pwd`/machines"
BOX_DIR="${BASE_DIR}/${BOX_NAME}"
mkdir -p ${BASE_DIR}
VBoxManage createvm --name "${BOX_NAME}" --ostype RedHat_64 --basefolder ${BASE_DIR}
VBoxManage registervm "${BOX_DIR}/${BOX_NAME}.vbox"
mkdir -p tmp
#!/bin/sh
# Sublime Text 3 install with Package Control
# http://simonewebdesign.it/install-sublime-text-3-on-linux/
# Run this script with:
# $ curl -L git.io/sublimetext | sh
# Detect the architecture

Yesterday I upgraded our running elasticsearch cluster on a site which serves a few million search requests a day, with zero downtime. I've been asked to describe the process, hence this blogpost.

To make it more complicated, the cluster was running elasticsearch version 0.17.8 (released 6 Oct 2011) and I upgraded it to the latest 0.19.10. There have been 21 releases between those two versions, with a lot of functional changes, so I needed to be ready to roll back if necessary.

Our setup:

  • elasticsearch

We run elasticsearch on two biggish boxes: 16 cores plus 32GB of RAM. All indices have 1 replica, so all data is stored on both boxes (about 45GB of data). The primary data for our main indices is also stored in our database. We have a few other indices whose data is stored only in elasticsearch, but are updated once daily only. Finally, we store our sessions in elasticsearch, but active sessions are cached in memcached.