Skip to content

Instantly share code, notes, and snippets.

View real420og's full-sized avatar
🦍

OG real420og

🦍
View GitHub Profile
@real420og
real420og / pfprint
Last active October 8, 2020 12:57
To print all rules pfctl (MacOS, FreeBSD)
#!/bin/bash
function pfprint() {
if [ -n "$1" ];then
sudo pfctl -a "$2" -s"$1" 2>/dev/null
else
sudo pfctl -s"$1" 2>/dev/null
fi
}
@real420og
real420og / gist:daa6006797f0535c2f68cd07f5141b5e
Created January 23, 2020 20:14
example docker build and push with gitlab/dind and tag (run after create tag)
stages:
- test
- deploy
test_job:
image: gitlab/dind
stage: test
only:
- tags
script:
@real420og
real420og / openssl.cnf.ini
Created February 11, 2020 16:23 — forked from garethrees/openssl.cnf.ini
Open SSL SAN
# Generate Private Key
$ openssl genrsa -out server.key 2048
# Generate CSR
$ openssl req -new -out server.csr -key server.key -config openssl.cnf
# => Fill in info
# Check CSR
$ openssl req -text -noout -in server.csr
# Sign Cert
$ openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt -extensions v3_req -extfile openssl.cnf
@real420og
real420og / sshtunnel.go
Created March 21, 2020 10:27 — forked from iamralch/sshtunnel.go
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"
"curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
":PlugInstall
if empty(glob("~/.vim/autoload/plug.vim"))
execute '!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.github.com/junegunn/vim-plug/master/plug.vim'
endif
if empty(glob("~/.vim/colors/darcula.vim"))
execute '!curl -fLo ~/.vim/colors/darcula.vim --create-dirs https://raw.githubusercontent.com/blueshirts/darcula/master/colors/darcula.vim'
endif
@real420og
real420og / double_slice.go
Created September 13, 2020 17:21 — forked from firelyu/double_slice.go
Double the length of slice interface
// http://stackoverflow.com/questions/42151307/how-to-determine-the-element-type-of-slice-interface#answer-42151765
// Call reflect.MakeSlice(), reflect.SliceOf() and reflect.Copy
func doubleSlice(s interface{}) (interface{}, error) {
if reflect.TypeOf(s).Kind() != reflect.Slice {
err := errors.New("The interface is not a slice.")
return nil, err
}
v := reflect.ValueOf(s)
newLength := v.Len()
set -g default-terminal 'screen-256color'
set -g mouse on
set -g prefix C-x
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'
set -g pane-active-border-style 'bg=black,fg=cyan'
setw -g pane-border-status bottom
setw -g pane-border-format '#{pane_tty} | #{pane_current_path}'
@real420og
real420og / Vagrantfile
Last active September 29, 2020 14:11
Vagrant Centos8 vbguest shared folder
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
echo "Installing packages..."
sudo dnf update -y && dnf upgrade -y
sudo dnf install -y epel-release
sudo dnf install -y git vim wget nc go tmux bcc-tools bison flex python3 cmake cmake3 gcc-c++ llvm-toolset clang clang-devel llvm llvm-devel llvm-static ncurses-devel iperf3
sudo dnf install -y http://repo.iovisor.org/yum/extra/mageia/cauldron/x86_64/netperf-2.7.0-1.mga6.x86_64.rpm
@real420og
real420og / upsource Dockerfile
Last active November 29, 2020 20:53
dockerfile upsource with php composer
FROM jetbrains/upsource:2020.1.1815
USER root
RUN apt-get update -y && apt-get install -y php
RUN apt-get install -y vim
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('sha384', 'composer-setup.php') === 'c31c1e292ad7be5f49291169c0ac8f683499edddcfd4e42232982d0fd193004208a58ff6f353fde0012d35fdd72bc394') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php --install-dir=bin --filename=composer && \
php -r "unlink('composer-setup.php');"
git config --global gpg.program $(which gpg)