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 / 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
}
Note for Windows users on 64-bit systems
Progra~1 = 'Program Files'
Progra~2 = 'Program Files(x86)'
@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 cameron.carr@example.com
Tim Burgess tim@example.us
Wanda Dyer wanda@example.com
Bella Dowd bella.dowd@example.com
Madeleine Mills madeleine.mills@example.us
grep -Eo '(\w+\.)?\w+@\w+\.[a-z]{2,3}$' names.txt
@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 / 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
# user@domain.lan , 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 / 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 / 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 / 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 / mkhomes.sh
Last active August 13, 2017 07:07
create home folders for ldap users in NFS export
#!/bin/bash
# Se foloseste in felul urmator
# - trebuie sa ai o lista cu useri in LDAP unul cate unul pe linie separata
# - rulezi scriptul './mkhomes.sh lista_useri.txt'
# Scriptul trebuie rulat pe un server integrat cu LDAP , pe CDN 99.99% .
if [ $# -ne 1 ];then
echo
echo -e "\t\t Usage: $0 users_file.txt"
echo -e "\t\t user_file must contain the users one per line"
@aduzsardi
aduzsardi / _verify-repair-permissions-disk.md
Created August 8, 2017 06:15 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /