Skip to content

Instantly share code, notes, and snippets.

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

Roes Wibowo RoesWibowo

💰
Available for hire!
View GitHub Profile
@RoesWibowo
RoesWibowo / index.js
Created October 30, 2020 00:47
Lambda function
const AWS = require('aws-sdk');
const ssm = new AWS.SSM();
const SSM_DOCUMENT_NAME = process.env.SSM_DOCUMENT_NAME;
const SNS_TARGET = process.env.SNS_TARGET;
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
@RoesWibowo
RoesWibowo / problem-solve.txt
Created November 28, 2019 16:48
[FIX] Failed to connect to the newrelic-daemon
I spent 2 hours+ and got stress about this issue: warning: daemon connect(fd=5 uds=/tmp/.newrelic.sock) returned -1 errno=ECONNREFUSED. Failed to connect to the newrelic-daemon. Please make sure that there is a properly configured newrelic-daemon running. For additional assistance, please see: https://newrelic.com/docs/php/newrelic-daemon-startup-modes
These are the steps to solve the issue:
> Check process using command: ps aux | grep newrelic
> Kill all newrelic-daemon process.
> Restart web server using command: service php-fpm restart && service nginx restart
> Newrelic daemon will automatically restart.
And, voila! (:
@RoesWibowo
RoesWibowo / 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:
@RoesWibowo
RoesWibowo / 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
@RoesWibowo
RoesWibowo / 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
@RoesWibowo
RoesWibowo / 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
@RoesWibowo
RoesWibowo / 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;
@RoesWibowo
RoesWibowo / 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"
@RoesWibowo
RoesWibowo / 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
@RoesWibowo
RoesWibowo / 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"