Skip to content

Instantly share code, notes, and snippets.

termdown '2017-09-18 23:59:59 ICT'
@thekitp
thekitp / install.sh
Created October 2, 2017 02:23
Install OpenCV 3 with Python 2.7 on Ubuntu
# Configuration
HOME_DIR=/home/[user]/
VERSION=3.2.0
# Installation
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y build-essential cmake pkg-config
sudo apt-get install -y libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
@thekitp
thekitp / softether.sh
Created December 12, 2017 11:33 — forked from vinchu/softether.sh
Install softether vpn server on ubuntu 16.04+
#!/usr/local/env bash
# Update system
apt-get update && apt-get -y upgrade
# Get build tools
apt-get -y install build-essential wget curl
# Define softether version
RTM=$(curl http://www.softether-download.com/files/softether/ | grep -o 'v[^"]*e' | grep rtm | tail -1)
IFS='-' read -r -a RTMS <<< "${RTM}"
@thekitp
thekitp / initd-nodhcp
Created January 13, 2018 23:48 — forked from abegodong/initd-nodhcp
Softether VPN + DNSMasq
#!/bin/sh
# chkconfig: 2345 99 01
# description: SoftEther VPN Server
DAEMON=/usr/local/vpnserver/vpnserver
LOCK=/var/lock/subsys/vpnserver
SERVER_IP=[SERVER_IP]
test -x $DAEMON || exit 0
case "$1" in
start)
$DAEMON start
@thekitp
thekitp / nginx-tuning.md
Created January 21, 2018 11:58 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@thekitp
thekitp / dnsmasq.conf
Last active February 4, 2018 11:30 — forked from billyriantono/dnsmasq.conf
/etc/init.d/vpnserver file for softether using Local Bridge
interface=tap_soft
dhcp-range=tap_soft,192.168.30.50,192.168.30.250,24h
dhcp-option=tap_soft,3,192.168.30.1
dhcp-option=tap_soft,option:dns-server,8.8.8.8,8.8.4.4
@thekitp
thekitp / client.py
Created February 9, 2018 09:28 — forked from kylehounslow/client.py
Send and receive images using Flask, Numpy and OpenCV
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
headers = {'content-type': content_type}

This is pretty simple snippet to get API Token of a user , lets say "MYUser" in jenkins.
its pretty useful when you are working with 'jenkins-job-builder' to update jobs in jenkins, and you need to get the api token which JJB needs inorder to update jobs to ..
run this code in either jenkins script console , or as i prefer, in form of init.groovy.
so when jenkins master starts, i create a user for JJb.
after that i get the token right away and pass it to my JJB jobs folder to file 'jenkins_jobs.ini' :)_ .

///////////////////////////////////////////////////////////////////////
@thekitp
thekitp / jenkins-workflow-docker-stash
Created July 15, 2018 02:40 — forked from dileeph/jenkins-workflow-docker-stash
jenkins workflow using 'stash' to pass files between two docker containers
node{
docker.image('buildpack-deps:jessie-scm').inside {
sh "echo 'hello' >> a.txt"
stash includes: 'a.txt', name: 'pom'
}
docker.image('buildpack-deps:jessie-scm').inside {
unstash 'pom'
sh "cat a.txt"
}
@thekitp
thekitp / cuda_installation_on_ubuntu_18.04
Created August 17, 2018 04:41 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
cuda 9.0 complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###