Skip to content

Instantly share code, notes, and snippets.

@superbrothers
superbrothers / ansi-color.php
Created August 23, 2012 01:49
ANSI color terminal output module for php
<?php
/**
* php-ansi-color
*
* Original
* https://github.com/loopj/commonjs-ansi-color
*
* @code
* <?php
* require_once "ansi-color.php";
@ctrl-shift
ctrl-shift / gist:5618320
Created May 21, 2013 08:27
postgres terminate all connections to db
select pg_terminate_backend(pid)
from pg_stat_activity
where datname = 'db name'
@thomasfr
thomasfr / autossh.service
Last active May 9, 2024 16:59
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@gavinhungry
gavinhungry / nginx-tls.conf
Last active July 18, 2024 11:35
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#
@dhruvbird
dhruvbird / smwc.py
Created February 11, 2015 06:53
Smallest multiple with constraints
"""
Problem statement:
------------------
Given a number 'n', design an algorithm that will output the smallest
integer number 'X' which contains only the digits {0, 1} such that
X mod n = 0 and X > 0
(1 <= n <= 100000)
"""
def solve(n):
if n < 2:
@johnrc
johnrc / jupyterhub-install.sh
Last active May 27, 2020 00:39
JupyterHub setup on centos
#!/bin/sh
curl -O http://repo.continuum.io/archive/Anaconda3-4.0.0-Linux-x86_64.sh
chmod u+x Anaconda3-4.0.0-Linux-x86_64.sh
./Anaconda3-4.0.0-Linux-x86_64.sh -b -p /opt/anaconda3
export PATH=/opt/anaconda3/bin:$PATH
curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
yum install nodejs -y
npm install -g configurable-http-proxy
pip install jupyterhub
@pcan
pcan / README.md
Created April 3, 2017 09:16
Compile Redis with Cygwin

Prerequisites

Install Cygwin with make, gcc & g++. Download Redis tar.gz package, unpack it.

Patch

Edit deps/hiredis/net.c and add the following lines just after the include directives:

@zealfire
zealfire / install_forticlientsslvpn_linux
Created July 2, 2017 14:31
Install forticlient in linux. Replace HOST, PORT, USER and PASS.
sudo apt-get install expect
wget http://kb.cloud.it/files/tar-gz/forticlientsslvpn_linux_4-0-2281-tar.gz
tar xzf forticlientsslvpn_linux_4-0-2281-tar.gz
sudo mv forticlientsslvpn /opt/
cat > sslvpn << EOF
#!/usr/bin/expect -f
set timeout -1
cd /opt/forticlientsslvpn
spawn ./forticlientsslvpn_cli --server HOST:PORT --vpnuser USER
expect "Password for VPN:" {send -- "PASS\r"}
@filipelenfers
filipelenfers / installJdkTarGzUbuntu.sh
Last active July 22, 2024 10:10
Install JDK from tar.gz Ubuntu
#Login as root
sudo su
#create jdk directory
mkdir /opt/jdk
#uncompress, change to your file name
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk
#check if files are there
@PieterScheffers
PieterScheffers / install_forticlient_linux.sh
Created January 22, 2018 16:28
Install Forticlient on Linux
# install ubuntu in virtual machine
# https://ubuntuforums.org/showthread.php?t=1481300
# Get arch type of ubuntu
# i686 = 32 bit
# x86_64 = 64 bit
uname -m
# download forticlient
https://hadler.me/linux/forticlient-sslvpn-deb-packages