Skip to content

Instantly share code, notes, and snippets.

@atomlab
atomlab / Dockerfile
Last active August 29, 2015 14:26 — forked from konklone/Dockerfile
Dockerfile for installing Ruby 2.0 and RVM
FROM ubuntu
MAINTAINER Eric Mill "eric@konklone.com"
# turn on universe packages
RUN echo "deb http://archive.ubuntu.com/ubuntu raring main universe" > /etc/apt/sources.list
RUN apt-get update
# basics
RUN apt-get install -y nginx openssh-server git-core openssh-client curl
RUN apt-get install -y nano
@atomlab
atomlab / genpassword
Created October 20, 2015 10:01 — forked from romaonthego/genpassword
Bash script: genpassword
#!/bin/bash
charspool=('a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p'
'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' '0' '1' '2' '3' '4' '5' '6' '7'
'8' '9' '0' 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O'
'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' '-' '_');
len=${#charspool[*]}
if [ $# -lt 1 ]; then
@atomlab
atomlab / bash.generate.random.alphanumeric.string.sh
Created October 20, 2015 13:37 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@atomlab
atomlab / tmux.conf
Last active September 25, 2018 10:26
tmux.conf
# tmux 2.6
# Requirement for plugins:
# apt install powerline
# List of plugins
set-environment -g TMUX_PLUGIN_MANAGER_PATH "$HOME/.tmux/plugins"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
@atomlab
atomlab / wigeguard_setup.md
Last active March 12, 2022 22:03
Wireguard setup on Ubuntu 18.04

Wireguard setup on Ubuntu 16.04/18.04

Install

# sudo add-apt-repository ppa:wireguard/wireguard
# sudo apt-get update
# sudo apt-get install wireguard

Generate keys

@atomlab
atomlab / jenkins_scripting_git_plugin_eviroments.md
Created January 7, 2020 12:38
Get an environment variables of git plugin in scripting pipeline

Jenkinsfile

node {
  dir ("checkout") {
    scmVars = checkout(scm)
    echo "${scmVars}"
    echo "scmVars.GIT_URL_1: ${scmVars.GIT_URL_1}"
    echo "scmVars.GIT_URL_2: ${scmVars.GIT_URL_2}"
  }
}
go get -u `go list -f '{{ join .Imports "\n" }}' api.go`
@atomlab
atomlab / tshark_examples.md
Last active January 25, 2020 08:45
Tshark Examples

Example 1

Method: POST
Port: 17076
interface: lo

tshark -i lo -Y "http.request.method == POST" -f 'dst port 17076' -T fields -e frame.time -e http.file_data

output

@atomlab
atomlab / cred.groovy
Created January 31, 2020 11:44
Jenkins job DSL scripts examples
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
def credStore(credentials_id) {
def cred_list = [:]
credentials_store = jenkins.model.Jenkins.instance.getExtensionList(
'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
)
credentials_store[0].credentials.each { it ->
if (it.id == credentials_id) {
@atomlab
atomlab / show_top_memory_usage_proc.md
Last active February 27, 2020 11:45
How to Find Out Top Memory Consuming Processes in Linux

ps

# ps aux --sort -rss | head

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
mysql     1064  3.2  5.4 886076 209988 ?       Ssl  Oct25  62:40 /usr/sbin/mysqld
varnish  23396  0.0  2.9 286492 115616 ?       SLl  Oct25   0:42 /usr/sbin/varnishd -P /var/run/varnish.pid -f /etc/varnish/default.vcl -a :82 -T 127.0.0.1:6082 -S /etc/varnish/secret -s malloc,256M
named     1105  0.0  2.7 311712 108204 ?       Ssl  Oct25   0:16 /usr/sbin/named -u named -c /etc/named.conf
nobody   23377  0.2  2.3 153096 89432 ?        S    Oct25   4:35 nginx: worker process