Skip to content

Instantly share code, notes, and snippets.

@zzzfree
zzzfree / sshTunnel.groovy
Last active December 27, 2018 12:23
ssh tunnel with groovy
import com.jcraft.jsch.JSch
import com.jcraft.jsch.Session
import com.jcraft.jsch.UserInfo
import com.jcraft.jsch.Channel
import com.jcraft.jsch.ChannelExec
def sshHost = '10.1.2.132'
def sshUser = 'root'
def sshPass = '******'
def sshPort = 22
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 12, 2024 07:08
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@scmx
scmx / upgrade-install-ruby-2-1-2-ubuntu-12-04.md
Last active November 6, 2019 15:31
Upgrade/Install ruby 2.1.2 #ubuntu #12.04 #14.04

Upgrade/Install ruby 2.1.2

ubuntu 12.04 14.04

Reference http://stackoverflow.com/a/18490935/2037928

Login as root

Install needed packages

apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@RobRuana
RobRuana / gohere
Last active July 24, 2023 10:51
Change $GOPATH to current directory to quickly switch between Go workspaces
#!/bin/bash -l
# Save this file in /usr/local/bin and chmod a+x for easy access
# Execute gohere to switch $GOPATH to current directory
# Type exit to switch back
# Example usage:
# $ echo $GOPATH
#
import java.util.concurrent.atomic.AtomicLong;
import rx.Observable.OnSubscribe;
import rx.*;
import rx.internal.operators.BackpressureUtils;
public final class RxRange implements OnSubscribe<Integer> {
final int start;
final int count;
public RxRange(int start, int count) {
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active May 10, 2024 14:59
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@isopropylcyanide
isopropylcyanide / apriori.cpp
Last active June 21, 2018 06:58
Data Mining : Apriori Frequent Pattern Identification using C++
#include <bits/stdc++.h>
using namespace std;
#define inputFile "apriorinput"
#define _MIN_SUPPORT 2
vector<set<int> > inputVec;
set<int> allItems;
/*
@isopropylcyanide
isopropylcyanide / Bash script to create user accounts.
Last active January 26, 2023 09:39 — forked from thimbl/script.sh
Shell script to create user accounts
#!/bin/bash
ROOT_UID=0
SUCCESS=0
E_USEREXISTS=70
# Run as root, of course. (this might not be necessary, because we have to run the script somehow with root anyway)
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script."
exit $E_NOTROOT
@isopropylcyanide
isopropylcyanide / littlechecker.py
Last active January 7, 2024 16:50 — forked from rajarsheem/littlechecker.py
A little code checker tool in python for Java,C,Cpp. Handles compile error, runtime error, accepted, wrong, TLE.
import os
import filecmp
import re
codes = {200: 'success', 404: 'file_name not found',
400: 'error', 408: 'timeout'}
class program:
"""Class that handles all nitty gritties of a user program"""