Skip to content

Instantly share code, notes, and snippets.

@thekitp
thekitp / Cargo.toml
Created April 27, 2020 14:39 — forked from fdb/Cargo.toml
Calling Rust from C++
[package]
name = "vec"
version = "0.1.0"
authors = ["Frederik De Bleser <[email protected]>"]
[lib]
name = "vec"
crate-type = ["dylib"]
[dependencies]
@thekitp
thekitp / Installing Python 3.7 from source on Ubuntu 18.04.md
Created August 15, 2019 07:26
Installing Python 3.7 from source on Ubuntu 18.04

Installing Python 3.7 from source on Ubuntu 18.04

# update system
sudo apt update && sudo apt upgrade -y

# install build tools and python prerequisites
sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev

# download and extract python
@thekitp
thekitp / Axis Speaker FFMPEG
Created April 19, 2019 05:41 — forked from wrannaman/Axis Speaker FFMPEG
Play audio (remote or local file) through axis speaker
ffmpeg -i https://s3-us-west-1.amazonaws.com/bucket/audio/file.wav \
-probesize 32 \
-analyzeduration 32 -c:a pcm_mulaw -ab 128k -ac 1 \
-ar 16000 -f wav -chunked_post 0 \
-content_type audio/axis-mulaw-128 \
http://root:[email protected]/axis-cgi/audio/transmit.cgi
@thekitp
thekitp / i3-config-move_workspace
Created February 8, 2019 05:24 — forked from magujs/i3-config-move_workspace
i3 move a worksapce to another monitor (multi monitor setup)
# i3 move a workspace to another monitor (multi monitor setup)
mode "move_workspace" {
bindsym Up move workspace to output up
bindsym Down move workspace to output down
bindsym Left move workspace to output left
bindsym Up move workspace to output up
bindsym Escape mode "default"
}
@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
###
@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"
}

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 / 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}
@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 / 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.