Skip to content

Instantly share code, notes, and snippets.

@norbornen
norbornen / nodejs-postgresql-ssh-tunnel-proxy.js
Created October 14, 2020 12:31
Node.js postgresql connecting with ssh-tunnel proxy
const fs = require('fs');
const os = require('os');
const tunnelSsh = require('tunnel-ssh');
const { Pool } = require('pg');
(async () => {
/** @type {import('net').Server} */
let tunnel;
try {
@rajkrrsingh
rajkrrsingh / Kafka-MirrorMaker-Set-Up.md
Created September 5, 2017 09:14
Kafka Mirror Maker - from source non-kerberized cluster to kerberized cluster

Kafka Mirror Maker - from source non-kerberized cluster to target (kerberized) cluster

Env:

source cluster:
HDP242
un-secure
hostname: rksnode1

destination cluster:
@deehzee
deehzee / psycopg2_sshtunnel.py
Last active January 16, 2025 15:22
How to Connect To PostgreSQL Using SSHTunnelForwarder and Psycopg2
import psycopg2
from sshtunnel import SSHTunnelForwarder
# For interactive work (on ipython) it's easier to work with explicit objects
# instead of contexts.
# Create an SSH tunnel
tunnel = SSHTunnelForwarder(
('128.199.169.188', 22),
ssh_username='<username>',
@MattDMo
MattDMo / ipy_repl.py
Last active April 3, 2022 23:16
SublimeREPL ipy_repl.py for running IPython/Jupyter in Sublime Text
# from https://gist.github.com/MattDMo/6cb1dfbe8a124e1ca5af
import os
import json
import socket
import threading
activate_this = os.environ.get("SUBLIMEREPL_ACTIVATE_THIS", None)
# turn off pager
@favadi
favadi / build-emacs.sh
Last active June 5, 2021 15:25
Compile latest emacs version (24.5) in Ubuntu 14.04
#!/bin/bash
# Build latest version of Emacs, version management with stow
# OS: Ubuntu 14.04 LTS
# version: 24.5
# Toolkit: lucid
# Warning, use updated version of this script in: https://github.com/favadi/build-emacs
set -e
#!/bin/bash
# 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.
# exit on error
set -e
TMUX_VERSION=1.8
@creaktive
creaktive / TerminusBold.dfont
Last active January 6, 2019 13:09
Terminus Powerline for Mac OS X
@fnurl
fnurl / bolarized_light.taskpapertheme
Created August 10, 2012 14:31
A taskpaper theme that is inspired by Byword, Solarized and iA Writer
<theme>
<!-- Extra colors -->
<color id="caret_blue" red="0" green="0.741" blue="1.0" alpha="1.0"/>
<color id="bg" red="0.988" green="0.988" blue="0.988" alpha="1.0"/>
<color id="fg" red="0.235" green="0.235" blue="0.235" alpha="1.0"/>
<color id="gray" red="0.5" green="0.5" blue="0.5" alpha="1.0"/>
<color id="light_blue" red="0.710" green="0.835" blue="1.0" alpha="1.0"/>
<!--Solarize color pallette, see http://ethanschoonover.com/solarized-->
<color id="blue" red="0.149" green="0.545" blue="0.824" alpha="1.0"/>
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active June 12, 2025 22:00
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@stevenworthington
stevenworthington / ipak.R
Created July 25, 2012 19:44
Install and load multiple R packages at once
# ipak function: install and load multiple R packages.
# check to see if packages are installed. Install them if they are not, then load them into the R session.
ipak <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE)
sapply(pkg, require, character.only = TRUE)
}