Skip to content

Instantly share code, notes, and snippets.

View roes888's full-sized avatar
💰
Available for hire!

Roes W roes888

💰
Available for hire!
  • Yogyakarta, DIY, Indonesia
  • 07:50 (UTC +07:00)
View GitHub Profile
@roes888
roes888 / site.conf
Last active August 21, 2016 04:58
Example apache2 virtual host using proxypass
# a2enmod proxy
# a2enmod proxy_http
# a2enmod proxy_ajp
# a2enmod rewrite
# a2enmod deflate
# a2enmod headers
# a2enmod proxy_balancer
# a2enmod proxy_connect
# a2enmod proxy_html
@roes888
roes888 / site.conf
Created August 21, 2016 04:58
Example nginx with alias without subdomain
server {
listen 80 deferred;
server_name server.com;
index index.php;
charset utf-8;
# App 1 (main app)
location / {
@roes888
roes888 / fix.sh
Created August 22, 2016 09:47
Change MySQL mode (Homestead)
mysql -u homestead -psecret -e "select @@sql_mode"
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
[mysqld]
# ... other stuff will probably be here
sql_mode = "STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
@roes888
roes888 / sysctl.conf
Created September 8, 2016 10:46
Getaway Linode ubuntu slow network
# add line below:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
# restart: sudo sysctl -p
@roes888
roes888 / setup.sh
Last active November 1, 2016 06:17
Install NFS Vagrant on Windows
// set variable windows to non-space folder
setx VAGRANT_HOME "drive:\path" /M
// install plugin
vagrant plugin install vagrant-winnfsd
vagrant plugin install vagrant-vbguest
//edit vagrant config
config.winnfsd.logging = "on"
@roes888
roes888 / fix.txt
Created March 15, 2017 06:16
MySQL 1153 - Got a packet bigger than 'max_allowed_packet' bytes
mysql --max_allowed_packet=100M -u root -p database < dump.sql
Also, change the my.cnf or my.ini file under the mysqld section and set:
max_allowed_packet=100M
or command MySQL:
set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
@roes888
roes888 / app.conf
Created March 17, 2017 08:45
Optimize Beanstalkd Queue
[program:sleekr-staging]
process_name=%(program_name)s_%(process_num)02d
command=php artisan queue:work --queue=staging1 --daemon --sleep=3 --tries=3
directory=/home/htdocs/deploy/staging/backend/current
stdout_logfile=/home/htdocs/deploy/staging/logs/supervisord.log
user=sleekr
redirect_stderr=true
autostart=true
@roes888
roes888 / instruction.txt
Created March 23, 2017 04:46
Change jenkins user linux
To change the jenkins user, open the /etc/sysconfig/jenkins (in debian this file is created in /etc/default) and change the JENKINS_USER to whatever you want. Make sure that user exists in the system (you can check the user in the /etc/passwd file ).
$JENKINS_USER="manula"
Then change the ownership of the Jenkins home, Jenkins webroot and logs.
chown -R manula:manula /var/lib/jenkins
chown -R manula:manula /var/cache/jenkins
chown -R manula:manula /var/log/jenkins
Then restarted the Jenkins jenkins and check the user has changed using a ps command
/etc/init.d/jenkins restart
ps -ef | grep jenkins
@roes888
roes888 / instruction.txt
Created March 24, 2017 00:51
MySQL Global Config
/*
Notes:
execute the function twice to see if the variable values are changed or not.
I did not bother with creating additional foreach queries for before and after.
If you exceed either the minimum or maximum values the Min|Max value will be used instead of your value.
integer is in bytes: 1024 = 1KB | 1073741824 = 1GB
max_allowed_packet
Permitted Values Type integer
@roes888
roes888 / cmd.sh
Created July 5, 2017 09:54
Command inode Ubuntu
# try to find if this is an inodes problem
df -ih
# find list directories of inode
du --inodes -d 3 /home/htdocs | sort -n | tail
# try to find root folders with large inodes count
for i in /*; do echo $i; find $i |wc -l; done
# try to find specific folders: