This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- enable extensions | |
-- full-text search on postgresql | |
CREATE EXTENSION unaccent; | |
-- languages supported | |
CREATE TEXT SEARCH CONFIGURATION fr ( COPY = french ); | |
ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING | |
FOR hword, hword_part, word WITH unaccent, french_stem; | |
CREATE TEXT SEARCH CONFIGURATION en ( COPY = english ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo rm -rf /var/lib/dpkg/info/*.* | |
sudo apt-get autoremove | |
sudo apt-get autoclean | |
sudo apt-get update | |
sudo apt-get upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Linux user management script | |
# to list all user on linux environment (listed in /etc/passwd) | |
getent passwd | |
# to list all groups on linux environment (listed in /etc/group) | |
getent group | |
# to add a new user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby prerequisites | |
sudo apt-get update | |
sudo apt-get install -y git gcc make libssl-dev libreadline-dev zlib1g-dev | |
# Native gem extensions prerequisites | |
sudo apt-get install -y g++ | |
#Install Ruby using rvm | |
sudo apt-get install -y libgdbm-dev libncurses5-dev automake libtool bison libffi-dev | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" != "" ]; then | |
case $1 in | |
-o | --open ) echo "$USER opening sshfs connection" | |
open your connection here | |
;; | |
-c | --close ) echo "$USER closing sshfs connection" | |
close your connection here | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
showips() { | |
NAMES=( $($IFC | grep "lo\|eth\|wlan" -A 1 | awk -F" " '{print $1 }' | grep -v "inet\|-\|UP" | sort -u) ) | |
for i in "${NAMES[@]}" | |
do | |
echo "$i has ip address: `$IFC | grep "$i" -A 1 | grep "addr" | awk -F" " '{print $2}' | awk -F":" '{print $2}'`" | |
done | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Start SSH agent | |
eval "$(ssh-agent -s)" | |
## Open SSH tunnel on port 3307 | |
ssh -fN -L 3307:127.0.0.1:3306 [email protected] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_schema "Data Base Name", SUM( data_length + index_length) / 1024 / 1024 | |
"Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE USER '<username>'@'%' IDENTIFIED BY '<password>'; | |
# ALL PRIVILEGES is everything except grant | |
GRANT ALL PRIVILEGES ON <database_name>.* TO '<username>'@'%'; | |
GRANT SELECT ON <database_name>.* TO '<username>'@'%'; | |
GRANT SELECT ON <database_name>.* TO '<username>'@'%'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Convert PEM into pub SSH key file: | |
ssh-keygen -e -f amazon-ec2-key.pem >> amazon-ec2-key.pem.pub | |
2. Generate a PEM from a SSH key: | |
openssl rsa -in my_tunneler -outform pem > my_tunneler.pem |