Skip to content

Instantly share code, notes, and snippets.

type tmux in terminal

Windows:

  • Create new window: Ctrl+b c
  • Move to next window: Ctrl+b n
  • Move to previos window: Ctrl+b p
  • List all wondows: Ctrl+b w

Panes/Split:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@knighthunter09
knighthunter09 / tweet_listener.py
Created April 9, 2019 05:38 — forked from hugobowne/tweet_listener.py
Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100 tweets have been streamed, the listener closes the file and stops listening.
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1

#Installing ngrok on OSX

  1. Download ngrok
  2. Unzip it to your Applications directory
  3. Create a symlink (instructions below)

Creating a symlink to ngrok

Run the following two commands in Terminal to create the symlink.

# cd into your local bin directory
@knighthunter09
knighthunter09 / Jenkinsfile
Created November 15, 2017 08:29 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
/*
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>
@knighthunter09
knighthunter09 / jenkins-pipeline.groovy
Created November 8, 2017 11:58 — forked from bullshit/jenkins-pipeline.groovy
Jenkins Pipeline Script for maven-release-plugin
#!groovy
docker.image('cloudbees/java-build-tools:0.0.6').inside {
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
extensions: [
/* [$class: 'UserIdentity', email: '[email protected]', name: 'Jenkins as a Service'], */
[$class: 'WipeWorkspace'],
[$class: 'LocalBranch', localBranch: 'master']],
userRemoteConfigs: [[credentialsId: 'github-credentials', url: 'https://github.com/cyrille-leclerc/my-spring-boot-app.git']]])
@knighthunter09
knighthunter09 / install_jenkins_plugin.sh
Created October 24, 2017 13:02 — forked from micw/install_jenkins_plugin.sh
Script to install one or more jenkins plugins including dependencies while jenkins is offline
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
@knighthunter09
knighthunter09 / 0. intro.md
Created October 12, 2017 02:27 — forked from jquense/0. intro.md
Alternative ways to define react Components

The 0.13.0 improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13 is that React Components are no longer special objects that need to be created using a specific method (createClass()). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!

Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns (https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&amp;%20object%20prototypes/ch4.md#mixins). All of the examples are of stateful components, and so need to delegate to React.Component for setState(), but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props and context to the component instance otherwise the component will be static. The reason is

@knighthunter09
knighthunter09 / python-zmq-workers.py
Created April 19, 2017 13:21 — forked from mdellavo/python-zmq-workers.py
python-zmq-worker-queue
import zmq
import logging
import uuid
MASTER_ENDPOINT = 'tcp://127.0.0.1:5000'
WORKER_ENDPOINT = 'tcp://127.0.0.1:5001'
log = logging.getLogger(__name__)
TASKS = {}
@knighthunter09
knighthunter09 / nodejs_kali_install.sh
Created August 13, 2016 07:43
NodeJS on Kali linux
#!/bin/bash
clear
if [[ $EUID -ne 0 ]]; then
echo "You must be root" 2>&1
exit 1
fi
ARCH=$(uname -m)