Skip to content

Instantly share code, notes, and snippets.

View thiagomgo's full-sized avatar
💜

Thiago Gomes thiagomgo

💜
  • Brazil
View GitHub Profile
@thiagomgo
thiagomgo / gist:16603603867c645df284a3eea72720c7
Last active March 1, 2018 14:55 — forked from weblancaster/gist:6e7f43fc02725ce747e224b0c4290906
Kill all container, remove all images and stop all containers
#stop all containers:
docker kill $(docker ps -q)
#remove all containers
docker rm $(docker ps -a -q)
#remove all old containers
docker rm $(docker ps --filter "status=exited" -q)
#remove all docker images
@thiagomgo
thiagomgo / php.ini
Created March 23, 2018 14:02
PHP suhosin config
[suhosin]
; Logging Configuration
suhosin.log.syslog.facility = 9
suhosin.log.use-x-forwarded-for = Off
; Executor Options
suhosin.executor.max_depth = 0
suhosin.executor.include.max_traversal = 4
suhosin.executor.disable_emodifier = On
suhosin.executor.allow_symlink = Off
@thiagomgo
thiagomgo / chroot.sh
Created March 25, 2018 16:47
Mount tips to chroot
sudo fdisk -l
sudo mount /dev/sdax /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
@thiagomgo
thiagomgo / imapsync.sh
Created January 25, 2019 19:08
Sync accounts using imapsync
#!/bin/bash
LISTA="/opt/sync-mail/list.txt"
LISTA_TMP="/tmp/list"
HOST_ORIGEM="xxx.xxx.xxx.xxx"
HOST_DESTINO="xxx.xxx.xxx.xxx"
cat ${LISTA}|grep -v "^#" | sed '/^ *$/d' > ${LISTA_TMP}
while IFS=: read usuario nome senha;do
@thiagomgo
thiagomgo / Update remote repo
Last active January 25, 2019 19:59 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/user/awesome-new-repo.git
$ git branch --set-upstream-to=origin/master master
$ git push origin master
$ git pull origin master --allow-unrelated-histories
@thiagomgo
thiagomgo / proxy_ajp.conf
Created February 1, 2019 21:30
Proxy AJP
<IfModule proxy_ajp_module>
ProxyPass "/" "ajp://127.0.0.1:10001/"
</IfModule>
@thiagomgo
thiagomgo / logrotate-kafka.sh
Last active February 11, 2019 21:26
logrotate kafka
##
## to test:
## logrotate -d /etc/logrotate.conf
##
## to enforce:
## logrotate -v -f /etc/logrotate.conf
##
/data/kafka/log/*.log {
daily
@thiagomgo
thiagomgo / rsync-txt-files.sh
Created August 2, 2019 14:02
Simple bash script to copy txt files to another directory.
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
set -e
set -o pipefail
FROM="/tmp/FROM/"
TO="/tmp/TO/"
DATE=$(date '+%d-%m-%Y %H:%M:%S')
LOG_FILE=/scripts/rsync-txt-files.log
@thiagomgo
thiagomgo / production.rb
Last active January 20, 2020 14:04 — forked from pvin/production.rb
Ruby on Rails production log rotation
# Log Rotate by initialising logger from the app
#Way one
# reference : http://ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html#method-c-new
# This one from Atinder Singh https://medium.com/@atinders/easy-log-rotation-with-rails-5-7b8d3c173461
# config/environments/production.rb
Rails.application.configure do
@thiagomgo
thiagomgo / check-user-web.php
Created February 10, 2020 13:16
Check which user is running under web server
<?
echo "I am running as user=";
system("whoami");
echo "<P>I can write here= ";
system("pwd");
$fname="write_test.txt";
if (file_exists($fname)) {
echo "<P> I found file $fname and will delete it";
unlink($fname);
echo "...Done";