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 / osx_flush_dns_cache
Created August 14, 2017 13:27
flush dns cache osx
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder;
# Info http://osxdaily.com/2015/11/16/howto-flush-dns-cache-os-x-elcap/
@aduzsardi
aduzsardi / osx-for-hackers.sh
Created August 17, 2017 17:02 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@aduzsardi
aduzsardi / posix
Created September 18, 2017 11:14
POSIX RegEx
# Info 'man 7 regex'
POSIX Basic Regular Expressions (BRE)
+ - ordinary char
? - ordinary char
| - ordinary char
\{\} - special chars
{} - regular chars
\(\) - special
() - regular
@aduzsardi
aduzsardi / openvpn-auth-ldap.conf
Created September 28, 2017 06:54
openvpn auth-ldap plugin config for ActiveDirectory
<LDAP>
# recomanded setting for URL is your AD domain FQDN , enable TLS and set the correct TLSCACertFile
URL ldap://10.100.10.100
# Bind DN for active directory can be
# a DN like CN=User01,OU=test,DC=domain,DC=lan
# user@DOMAIN , where DOMAIN is your ActiveDirectory NetBios domain name
# [email protected] , where domain.lan is your ActiveDirectory FQDN , this is called UPN or userPrincipalName
BindDN CN=User01,OU=test,DC=domain,DC=lan
Password P@ssw0rd
Timeout 15
@aduzsardi
aduzsardi / tsv2csv.sh
Last active October 9, 2017 07:16
bash tab separated values to comma separated values
#!/bin/bash
# Alex Duzsardi @aduzsardi
# made it more portable by using 'tr' instead of 'dos2unix'
if [[ $# -ne 1 ]]; then
echo "Usage: ./$0 tab-delimited-file.txt"
else
tr -d '\r' < "$1" | sed -r -e 's/\t/","/g' -e 's/^/"/g' -e 's/\s+(")/\1/g' -e 's/(\s+)?$/"/g' > "$1".csv
fi
@aduzsardi
aduzsardi / grep_match_email
Created October 4, 2017 12:04
grep match email address - print only matched substring
# Match email address from list of Name,Email , email can be with country code domain or company domain.
# List of names (file names.txt)
Cameron Carr [email protected]
Tim Burgess [email protected]
Wanda Dyer [email protected]
Bella Dowd [email protected]
Madeleine Mills [email protected]
grep -Eo '(\w+\.)?\w+@\w+\.[a-z]{2,3}$' names.txt
Note for Windows users on 64-bit systems
Progra~1 = 'Program Files'
Progra~2 = 'Program Files(x86)'
@aduzsardi
aduzsardi / tsv2csv.sh
Last active March 4, 2019 07:13
tsv2csv_v2
function tsv2csv() {
if [[ $# -ne 1 ]]; then
echo "Usage: ./$0 tab-delimited-file.txt"
else
tr -d '\r' < "$1" | sed -r -e 's/\t/","/g' -e 's/^/"/g' -e 's/\s+(")/\1/g' -e 's/(\s+)?$/"/g' > "$1".csv
fi
}

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:

@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