Skip to content

Instantly share code, notes, and snippets.

View doniz's full-sized avatar

Donatas Navidonskis doniz

View GitHub Profile
doniz / terraform_output_after_destroyed.log
Created August 25, 2022 12:11
Gitlab Terraform issue #671
View terraform_output_after_destroyed.log
2022-08-25T14:56:27.281+0300 [INFO] Terraform version: 1.2.8
2022-08-25T14:56:27.281+0300 [DEBUG] using v1.0.0
2022-08-25T14:56:27.281+0300 [DEBUG] using v2.12.0
2022-08-25T14:56:27.281+0300 [DEBUG] using v0.0.0-20210209133302-4fd17a0faac2
2022-08-25T14:56:27.281+0300 [DEBUG] using v0.0.0-20200729002733-f050f53b9734
2022-08-25T14:56:27.281+0300 [DEBUG] using v1.11.0
2022-08-25T14:56:27.281+0300 [INFO] Go runtime version: go1.18.1
2022-08-25T14:56:27.281+0300 [INFO] CLI args: []string{"/opt/homebrew/Cellar/tfenv/2.2.2/versions/1.2.8/terraform", "apply"}
2022-08-25T14:56:27.281+0300 [DEBUG] Attempting to open CLI config file: /Users/REDACTED/.terraformrc
2022-08-25T14:56:27.281+0300 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
doniz /
Created August 28, 2019 15:45 — forked from qzaidi/
capture http headers

HTTP Headers

tcpdump -A -s 10240 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' | egrep --line-buffered "^........(GET |HTTP\/|POST |HEAD )|^[A-Za-z0-9-]+: " | sed -r 's/^........(GET |HTTP\/|POST |HEAD )/\n\1/g'

Postgres Queries

sudo tcpdump -i lo -s0 -nl -w- dst port postgres | strings -n8
doniz / Makefile
Last active August 12, 2019 09:11 — forked from StanAngeloff/Makefile
Generate RabbitMQ self-signed certificate authority, server and client certificates.
View Makefile
# See
# (c) Stan Angeloff /
SHELL := /bin/bash
HOSTNAME ?= $(shell hostname)
PASSPHRASE ?= $(shell cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
doniz /
Created December 4, 2018 13:21 — forked from christopher-hopper/
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

doniz /
Last active September 18, 2018 07:13
delete git local branches from file
# put branch list to file "git branch -l | grep some-filter-text > branch-list.txt"
# serve branch list from file
BRANCHES=$(cat branch-list.txt)
git branch -d $BRANCH -f;
doniz /
Last active September 11, 2018 11:46
find modfied files in unix
find . -type f -printf '%TY-%Tm-%Td\n' | sort | uniq -c
doniz /
Created August 3, 2018 17:18
migrate mysql database from host to host

migrate mysql database from host to host

# migrate specific database
mysqldump -u root -proot -h192.168.91.100 --databases database_name | mysql
# migrate all database from the server
mysqldump -u root -proot -h192.168.91.100 --all-databases | mysql
doniz /
Last active July 20, 2018 19:01
get all files recursively from directory with bash
#!/usr/bin/env bash
FILES=$(find "/etc/nginx" -type f)
View gist:f064056965f5c341542e1278faf3a213
application – required
repository – required
scm – defaults to :subversion
deploy_via – defaults to :checkout
revision – defaults to the latest head version
rails_env – defaults to ‘production’
rake – defaults to ‘rake’
source – Capistrano::Deploy::SCM object
doniz / gist:da95428e30bdbf193ba289fd1d0487fe
Created April 23, 2018 10:31
show largest file on unix
View gist:da95428e30bdbf193ba289fd1d0487fe
BREAK="===============================================================";echo -ne "\n $BREAK \n \t Disk Usage for $(pwd) $(date +'%F') \n $BREAK \n\n";df -h $(pwd); echo -e '\n\n Volume Group Usage: \n'; vgs $(df -h $(pwd) | grep dev | awk '{print $1}'| cut -d\- -f1| cut -d\/ -f4); echo -e '\n'; echo -e "Largest Folders:\n"; du -xSk $(pwd) | sort -rn | head -30|awk '{printf "%d MB\t%s\n",($1/1024),$NF}' && echo -e "\n\n"; echo -e "Largest Files:\n"; find $(pwd) -mount -type f -ls|sort -rnk7 |head -30|awk '{printf "%d MB\t%s\n",($7/1024)/1024,$NF}';echo -e "\n\n Open Deleted Files:\n" ;lsof | grep $(pwd) | grep deleted| awk '{ if($7 > 1048576) print $7/1048576, "MB ",$9,$1 }' | sort -n -u | tail; echo -e "\n $BREAK"