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 / backup.sh
Created April 5, 2017 12:41
FTP Backup Script bash
#!/bin/sh
# Script pentru backup remote prin ftp
# Dependente: mysql,mysqldump,gzip,curlftpfs
#
# Autor: Alex Duzsardi alex[dot]duzsardi[at]pitechplus[dot]com
# www.pitechplus.com
# ---------------------------------------------------------------------
### Variabile si configuratii ###
#!/bin/bash
# Configurare firewall ('man iptables') linux
# Cerinte: privilegii elevate (root)
# Setari: copiaza scriptul undeva accesibil doar de userul 'root' ,
# editeaza /etc/rc.local si inainte de 'exit 0' adauga calea absoluta spre script ex: /root/firewall.sh
# Contact: Alex Duzsardi <alex.duzsardi@pitechplus.com>
# www.pitechplus.com
#--------------------------------------------------------------
# Scriptul va rula cu debuging activat
@aduzsardi
aduzsardi / osx-install-media.md
Created July 24, 2017 11:39 — forked from cobyism/osx-install-media.md
Command to create installable OS X USB drive.

Creating a bootable macOS USB installer

  • First, plug in an 8GB (or bigger) USB drive, and use Disk Utility to erase it
  • If you use the default settings, you should wind up with a blank drive at /Volumes/Untitled.

With that volume in place, and with the macOS installer sitting in /Applications/Install\ macOS\ [VERSION].app, run the following command in your terminal to create a bootable install media (for Sierra):

sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ macOS\ Sierra.app --nointeraction
@aduzsardi
aduzsardi / sshd_config
Created July 25, 2017 06:51
disable root login with password
#You can do this using the PermitRootLogin directive. From the sshd_config manpage:
#
# Specifies whether root can log in using ssh(1). The argument must be “yes”, “without-password”, “forced-commands-only”, or “no”. The default is “yes”.
#
# If this option is set to “without-password”, password authentication is disabled for root.
#
#The following will accomplish what you want:
@aduzsardi
aduzsardi / lb_vhost.conf
Created July 25, 2017 07:24
Load balancing apache config
<VirtualHost *:443>
LoadModule slotmem_shm_module /usr/lib/apache2/modules/mod_slotmem_shm.so
LoadModule proxy_balancer_module /usr/lib/apache2/modules/mod_proxy_balancer.so
LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so
ServerName dev.mydomain.com
<Proxy "balancer://mycluster">
BalancerMember "http://10.0.0.167:9090"
BalancerMember "http://10.0.0.168:9090"
@aduzsardi
aduzsardi / ssh-keygen-man
Created July 25, 2017 07:27
ssh-keygen command options and examples
SSH-KEYGEN
ssh-keygen
- generate ssh authentication keys
- default RSA key
- -t option for other types DSA,ECDSA,ED25519
- can generate DH (Diffie-Hellman group exchange DH-GEX)
- can generate and update Key Revocation Lists
OPTIONS
-A = create sshd keys (host keys)
@aduzsardi
aduzsardi / p7s_decrypt.sh
Created July 25, 2017 07:28
extract files from p7s attachments
#!/bin/bash
openssl pkcs7 -inform DER -in "$1" -print_certs -out "$1.pem"
openssl smime -verify -in "$1" -inform der -noverify -signer "$1.pem" -out "$1.pdf" 2>/dev/null
rm "$1.pem"
evince "$1.pdf"
rm "$1.pdf
@aduzsardi
aduzsardi / vim_commands
Created July 25, 2017 07:29
vim commands
VIM Commands
:vsp = vertical split
:sp = horizontal split
:quit - close current split
ctrl+w+w - change splited windows
:x - save and exit
:q - quit
:q! - quit without saving changes
:wq - write changes and quit
@aduzsardi
aduzsardi / dscl_create_user.sh
Created July 25, 2017 07:32
osx create user with dscl
dscl . -create /Users/myuser
dscl . -create /Users/myuser UserShell /bin/zsh
dscl . -create /Users/myuser RealName "myuser"
dscl . -create /Users/myuser UniqueID "510"
dscl . -create /Users/myuser PrimaryGroupID 20
dscl . -create /Users/myuser NFSHomeDirectory /Users/myuser
dscl . -passwd /Users/myuser password
dscl . -append /Groups/admin GroupMembership myuser
@aduzsardi
aduzsardi / kadmin-fix
Created July 25, 2017 07:34
kadmin: GSS-API (or Kerberos) error while initializing kadmin interface
# kadmin: GSS-API (or Kerberos) error while initializing kadmin interface
install rng-tools
edit /etc/default/rng-tools
add line HRNGDEVICE=/dev/urandom , restart rng-tools service
edit /etc/init.d/krb5-admin-server , edit variable DAEMON_ARGS="-W /dev/urandom"