Skip to content

Instantly share code, notes, and snippets.

@pawitk
pawitk / gist:f93185cd172bfa0b80f3921b34af0be0
Created April 19, 2019 18:11
increase osx mojave file limit
echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=65536
sudo sysctl -w kern.maxfilesperproc=65536
ulimit -n 65536
# Put in /etc/logrotate.d/
/path/to/*.log {
rotate 30
daily
compress
missingok
notifempty
create 0640 deploy deploy
sharedscripts
postrotate
@pawitk
pawitk / .pgpass
Last active June 5, 2018 01:23
Postgresql backup
# db credentials
hostname:port:database:username:password
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCnzJPwVaOk1CCwbssiMh0FfcRVRY005fI+w7njLT4lus7YAIntyQwUsOzTfiLthgM07pZTKdTlPts6i1X/vigxUoJviZDnMbaXwD5v0TNB+Bd5KFGKrEuKFdIiW3jf4F0xqn5g8s3hjDPDYzCAgTGzLVUdPmc+bUx7A7eC/Mge3rvkQyj0HFHTVQ+Gc5GB7Q5kJh+MmgyhF6mLOUq1rHIB8uBGSXR2qrpH0gFB2qrFxBJMOw1XaC5P7DgabIQpiwKVbFU+SvqtIpQykboJG1RUlt56HqUTM27Bp2j6QxA6JwmoLKKt9DmIGo7xXdQvIvfc8YsK7IYwcEnEM8necchd pawit@Pawits-MacBook-Pro.local
@pawitk
pawitk / clear.sh
Created September 24, 2017 07:49
clear old kernels on ubuntu 16.04
dpkg -l linux-{image,headers}-* | awk '/^ii/{print $2}' | egrep '[0-9]+\.[0-9]+\.[0-9]+' | grep -v $(uname -r | cut -d- -f-2) | xargs sudo apt-get -y purge
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee --append /etc/fstab
@pawitk
pawitk / init_nginx.sh
Last active August 29, 2015 14:24
nginx launch
wget -O init-nginx.sh https://gist.githubusercontent.com/pawitk/7fa6d86dc8db3236a6b0/raw/d436d327d2dadac67ddbd9c66161a9e72a0f484a/init_nginx.sh
sudo mv init-nginx.sh /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults
@pawitk
pawitk / gist:e866e152be676fff664e
Created February 2, 2015 17:07
digital ocean 14.04 add swap
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo su -c "echo '/swapfile none swap sw 0 0' >> /etc/fstab"
sudo su -c "echo 'vm.swappiness=10' >> /etc/sysctl.conf"
sudo su -c "echo 'vm.vfs_cache_pressure = 50' >> /etc/sysctl.conf"
@pawitk
pawitk / run.sh
Created November 17, 2014 06:09
Meteor.js folder structure
mkdir client
mkdir server
mkdir lib
mkdir public
touch client/main.html
touch client/main.css
touch client/main.js
meteor add iron:router
meteor add mizzao:bootstrap-3
mkdir client/stylesheets
Verifying that +pawitk is my Bitcoin username. You can send me #bitcoin here: https://onename.io/pawitk