Skip to content

Instantly share code, notes, and snippets.

View aduzsardi's full-sized avatar
🛠️
d(0_0)b

Alexandru Duzsardi aduzsardi

🛠️
d(0_0)b
View GitHub Profile
@aduzsardi
aduzsardi / nginx.conf
Created September 7, 2018 13:03
nginx - log post body to stdout
location /events {
if ($request_method = POST) {
access_log /dev/stdout post_body if=$loggable;
proxy_pass $scheme://127.0.0.1/logsink;
break;
}
return 200 "ok";
}
location /logsink {
@aduzsardi
aduzsardi / ubuntu-cloud-virtualbox.sh
Created July 24, 2018 11:10 — forked from smoser/ubuntu-cloud-virtualbox.sh
example of using Ubuntu cloud images with virtualbox
## Install necessary packages
$ sudo apt-get install virtualbox-ose qemu-utils genisoimage cloud-utils
## get kvm unloaded so virtualbox can load
$ sudo modprobe -r kvm_amd kvm_intel
$ sudo service virtualbox stop
$ sudo service virtualbox start
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
@aduzsardi
aduzsardi / Vagrantfile-multi-box
Created June 18, 2018 12:16
multibox vagrantfile
Vagrant.configure(2) do |config|
config.ssh.insert_key = false
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
config.vm.define "myapp1" do |app|
app.vm.hostname = "myapp1.dev"
app.vm.box = "ubuntu/xenial64"
app.vm.network :private_network, ip: "192.168.99.10"
@aduzsardi
aduzsardi / Disable gnome-keyring-ssh
Created May 15, 2018 05:27 — forked from beli-sk/Disable gnome-keyring-ssh
Disable Gnome Keyring SSH agent in (X)Ubuntu
# Disable Gnome Keyring SSH agent in Ubuntu
# To allow using ssh-agent from OpenSSH, mainly because
# gnome-keyring does not like EC-type SSH keys
# as regular user (for which to disable):
systemctl --user mask gnome-keyring-ssh.service
pam-auth-update
# and disable "GNOME Keyring Daemon..."
# which probably also disables automatic keyring unlocking on login
@aduzsardi
aduzsardi / Remove-VirtualBoxHostOnlyNetworkInterfaces.ps1
Created April 1, 2018 08:34 — forked from rgl/Remove-VirtualBoxHostOnlyNetworkInterfaces.ps1
Remove all VirtualBox Host-Only network interfaces (Windows)
# NB this depends on devcon. you must install it from chocolatey with choco install -y devcon.portable
$devcon = "$ENV:ProgramData\Chocolatey\Lib\devcon.portable\Devcon$(if ($ENV:PROCESSOR_ARCHITECTURE -like '*64') {'64'} else {'32'}).exe"
Get-NetAdapter `
| Where-Object {$_.Virtual} `
| Where-Object {$_.DriverFileName -like 'VBox*.sys'} `
| ForEach-Object {
Write-Host "Removing the $($_.InterfaceAlias) interface..."
$result = &$devcon remove "@$($_.PnPDeviceID)"
@aduzsardi
aduzsardi / ca-init
Created March 27, 2018 06:51
Create CA with openssl
#!/bin/bash
# Usage: `./ca-init test` - this will create a CA cert with CN = My TEST CA
# server,client certs will be generated with ansible, but i needed the CA to be manually generated for each environment.
PKI_BASE="$1"
PKI_HOME="${PKI_HOME:="/keybase/private/${USER}/pki"}"
PKI_PATH="${PKI_HOME}/${PKI_BASE}"
# validity days
PKI_CA_VALIDITY="7300"
# key settings
@aduzsardi
aduzsardi / check-mem.sh
Created January 10, 2018 09:55
percentage available memory linux os
awk -v memt=$(grep -E 'MemTotal:' /proc/meminfo | awk '{print $2}') -v mema=$(grep -E 'MemAvailable:' /proc/meminfo | awk '{print $2}') "BEGIN {printf \"%.2f\n\", (mema/memt)*100}"
@aduzsardi
aduzsardi / hashicorp-dwnl.sh
Last active January 3, 2018 14:54
get latest hashicorp tools
#!/bin/bash
down_url=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/$1 | jq -r .current_download_url)
product=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/$1 | jq -r .product)
version=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/$1 | jq -r .current_version)
os="linux_amd64"
wget ${down_url}${product}_${version}_${os}.zip
# There are a lot of inconsistencies in the resulting json answer between their products , so this will not work
@aduzsardi
aduzsardi / consul-cluster.sh
Created December 22, 2017 14:06
AWS Ubuntu16 consul cluster with autojoin
#!/bin/bash
# Create 3 EC2 instances - add tag=consul_join , value=cluster to each
# EC2 cmds (as root):
# -----
apt-get -yqq install unzip &>/dev/null
cd /tmp
curl -sLo consul.zip https://releases.hashicorp.com/consul/1.0.2/consul_1.0.2_linux_amd64.zip
unzip consul.zip >/dev/null
chmod +x consul

Keybase proof

I hereby claim:

  • I am aduzsardi on github.
  • I am aduzsardi (https://keybase.io/aduzsardi) on keybase.
  • I have a public key ASBApsrc0qMPLOjVvuO7OyOEqxoMmvc_-nQXstKIYt7n-go

To claim this, I am signing this object: