Notes

Things I use a lot…

Setup

sudo apt-get install apache2

PHP

ini_set(‘display_errors’, ‘On’); error_reporting(E_ALL); scl enable rh-php56 bash

Apache Management

apachectl configtest apachectl graceful (not on RHEL) systemctl start httpd.service systemctl stop httpd.service systemctl restart httpd.service sysv-rc-conf sudo service httpd reload

Git

ls -al ~/.ssh (if any id_*.pub files, use that, otherwise…) //ssh-keygen -t rsa -b 4096 -C "your_email@example.com" ssh-keygen -o -a 100 -t ed25519 -C "your_email@example.com" (creates folder and uses id_rsa.pub by default) eval $(ssh-agent -s) ssh-add ~/.ssh/id_rsa copy the entry from id_rsa.pub to a deploy key in the project (mind the white space) ssh -T git@github.com git config –global user.name “name” git config –global user.email e@mail git config –global core.editor nano git checkout --track origin/branch

Puppet

puppet agent -t --noop puppet agent -t puppet agent --disable "reason" puppet agent --enable cat $(puppet config print vardir)/state/agent_disabled.lock

Unixy

ln -s /target ./link export EDITOR=`which nano` sshfs $USER@hostname:/path/ /mountfolder/ fusermount -u path alt f2 xkill ssh-keygen -R hostname (removes known hosts fingerprints) /etc/ssh/ssh_config add ServerAliveInterval 60 ssh-copy-id -i [keypath] -p [port] [host] EDITOR='nano' crontab -e -u [[user]] find [path] -name [pattern]

RHELy

cat /etc/redhat-release

Nano

Alt+/ to skip to end
Alt+# to show line numbers (or start with -c)

Virtual Box

VBoxManage modifyvm “VM name” —natpf1 “rulename,tcp„listenport„forwardtoport” VBoxManage modifyvm “VM name” —natpf1 delete “rulename”

Emoticons

¯\_(ツ)_/¯ t_(ツ)_ƒ ‎(ƒ ;..;)ƒ ʕ •ᴥ•ʔ ಲ_ಲ ಥ_ಥ ಠ_ಠ ╭∩╮(︶︿︶)╭∩╮ ●﹏● (¤﹏¤) (・_・) (Θ︹Θ) ( .. ) (´. _ .`) ● ﹏☉ (´・_・`)

MySQL

SELECT @rank:=@rank+1 AS rank, id, whatever FROM table AS t, (SELECT @rank:=0) AS r;

MsSQL

SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE=‘BASE TABLE’ SELECT * FROM [schema].INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'tableName’

PSQL

psql --username=user --password --host=localhost \l (list all schema) \c \dt (list tables) COPY table TO '/tmp/file.csv' DELIMITER ',' CSV HEADER; \d (list all user’s tables) COPY (SELECT ...) TO '/tmp/file.csv' WITH CSV DELIMITER ',' HEADER;

Mac

defaults write com.apple.finder AppleShowAllFiles YES