Skip to content

Instantly share code, notes, and snippets.

View samqi's full-sized avatar

Sam samqi

  • .MY
View GitHub Profile
@samqi
samqi / rc.firewall
Created January 26, 2017 08:23 — forked from lopes/rc.firewall
My template to configure iptables.
#!/bin/bash
#rc.firewall
#
#
# Firewall configuration file.
#
#
# AUTHOR: José Lopes Oliveira Jr. <indiecode.com.br>
#
#
@samqi
samqi / spectre-meltdown.sh
Created January 11, 2018 10:00
spectre and meltdown checker
git clone https://github.com/speed47/spectre-meltdown-checker.git
cd spectre-meltdown-checker/
sudo sh spectre-meltdown-checker.sh

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@samqi
samqi / yocto-rpi.sh
Created May 5, 2018 16:29
yocto-rpi
# old ref with 12mb image for R Pi https://www.cnx-software.com/2013/07/05/12mb-minimal-image-for-raspberry-pi-using-the-yocto-project/
#########################################################
# 2018 - yocto for R Pi - http://www.jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html
# install dependency on build machine/server
sudo apt install build-essential chrpath diffstat gawk libncurses5-dev texinfo python2.7
#
#get main Yocto project poky layer
git clone -b rocko git://git.yoctoproject.org/poky.git poky-rocko
cd poky-rocko
#get the dependency layers - repositories shouldn’t need modifications other then periodic updates and can be reused for different projects or different boards.
@samqi
samqi / change_db_owner.sh
Created June 26, 2018 07:58 — forked from gingerlime/change_db_owner.sh
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@samqi
samqi / awkshortcuts.txt
Last active June 27, 2018 07:31
use awk to clear first column from history
#use awk to output history commands without the numbers
awk '{print $2,$3,$4,$5,$6,$7}' history.txt >> commands.txt
#get the ip addresses https://www.cyberciti.biz/tips/read-unixlinux-system-ip-address-in-a-shell-script.html
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
#get private and public IP for linode node via CLI (old version) https://github.com/linode/cli
linode show linodenode| grep ips | awk '{ print $2,$3}'
@samqi
samqi / devops_best_practices.md
Created August 3, 2018 09:39 — forked from jpswade/devops_best_practices.md
Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud, open source and business](https://blogs.the451group.com/opensource/2010/03/03/devops-mixing-dev-ops-agile-cloud-open-source-and-busi

@samqi
samqi / keybase.md
Created June 26, 2019 15:03
Keybase Proof

Keybase proof

I hereby claim:

  • I am samqi on github.
  • I am samqi (https://keybase.io/samqi) on keybase.
  • I have a public key ASD7_P33ddVzD8HeTd0Bjs5VXmVKZrsh6d57Zy_wXAYzSQo

To claim this, I am signing this object:

@samqi
samqi / openvpn-server.sh
Created May 4, 2018 14:45
OpenVPN setup
#become root and add key
sudo su -
wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg|apt-key add -
echo "deb http://build.openvpn.net/debian/openvpn/stable xenial main" > /etc/apt/sources.list.d/openvpn-aptrepo.list
apt-get update && apt-get install openvpn
#Based Linode Hardened https://www.linode.com/docs/networking/vpn/set-up-a-hardened-openvpn-server/
#require signed HMAC sig file for access
openvpn --genkey --secret /etc/openvpn/server/ta.key
openssl genpkey -genparam -algorithm DH -out /etc/openvpn/server/dhp4096.pem -pkeyopt dh_paramgen_prime_len:4096
@samqi
samqi / virtualbox.bat
Last active March 17, 2020 10:30
virtualbox cli command
# List virtual machines
VBoxManage list vms
"MyVM" {wwwwww-4301-4a7d-8af8-fe02fed00451}
# Start VM in headless mode
VBoxManage startvm MyVM --type headless
# Power off VM
VBoxManage controlvm MyVM poweroff