Skip to content

Instantly share code, notes, and snippets.

View lucien144's full-sized avatar
🤘
Refactor!

lucien144

🤘
Refactor!
View GitHub Profile
@lucien144
lucien144 / .bash_profile
Last active June 20, 2022 13:18
Server .bashrc
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

Keybase proof

I hereby claim:

  • I am lucien144 on github.
  • I am lucien144 (https://keybase.io/lucien144) on keybase.
  • I have a public key ASDFejBGrN-ygUjU4gIvMTWeg4DdYuJMZPvFBh_Ezl4w3wo

To claim this, I am signing this object:

@lucien144
lucien144 / reports.sh
Created June 6, 2017 08:29
GoAccess monthly reports with summary report
#!/bin/bash
START=$SECONDS
FILES=/var/www/vhosts/site.com/logs/access-2*.log
# Generate summary
goaccess /var/www/vhosts/site.com/logs/access.log --geoip-database /var/www/vhosts/site.com/logs/GeoIP.dat -o /var/www/vhosts/site.com/web/web/reports/summary.html
# Generate monthly reports
# -> Split logs
@lucien144
lucien144 / run.md
Last active January 20, 2021 12:48
MariaDB mounted to tmpfs with Docker
  1. Pull mariadb image docker pull mariadb

  2. Run container

docker run \
    --name mariadb \
    -p 4306:3306 \
    --tmpfs /var/lib/mysql:rw \
 -e MYSQL_ROOT_PASSWORD=root \
@lucien144
lucien144 / init.coffee
Last active January 16, 2017 00:18
My Atom's configuration.
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@lucien144
lucien144 / atomic.sh
Created November 24, 2016 23:30
Atomic shell script for cronjobs
#!/bin/sh
# Author: http://serverfault.com/questions/191083/how-can-i-run-a-script-from-cron-only-once-at-a-time/639747
LOCKDIR=/tmp/.myprog.lock
mkdir $LOCKDIR || exit 0
trap "{ rm -rf $LOCKDIR ; exit 0; }" EXIT
echo "a"
sleep 30
echo "b"
@lucien144
lucien144 / AccelerometerSingleton.as
Last active November 23, 2016 22:59
Parallax effect for Starling's display objects
package com.thebutton.utils {
import flash.events.AccelerometerEvent;
import flash.sensors.Accelerometer;
/**
* Accelerometer is now a singleton - saves a lot of events being created and fired - for better performance.
* @author Jakub Wagner, thebuttongame.io
*/
public class AccelerometerSingleton {
private static var _instance:AccelerometerSingleton = new AccelerometerSingleton();
@lucien144
lucien144 / mysqlbackup.sh
Last active November 6, 2016 23:16
MySQL backup of database w/ separated tables and S3 sync
#!/bin/bash
START=$SECONDS
DATE=`date +%Y%m%d%H%M`
MYSQL=mysql
MYSQLDUMP=mysqldump
DBNAME="dbname"
USER="mysqldump"
PASSWORD="***"
mkdir $DATE
@lucien144
lucien144 / startup.sh
Created November 1, 2016 00:08
Vultr startup scripts
#!/bin/bash
adduser --disabled-password --gecos "Admin" admin
echo admin:`openssl rand -base64 32` | chpasswd
echo "admin ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
mkdir -p /home/admin/.ssh/
echo "ssh-rsa ..." > /home/admin/.ssh/authorized_keys
chmod 700 /home/admin/.ssh/
chmod 600 /home/admin/.ssh/authorized_keys
chown -R admin:admin /home/admin/.ssh
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
@lucien144
lucien144 / backup.sh
Last active September 10, 2018 13:09
MySQL backup using s3cmd & automysqlbackup
#!/bin/bash
apt-get install automysqlbackup
apt-get install s3cmd
s3cmd --configure
s3cmd sync --recursive --delete-removed /var/lib/automysqlbackup/ s3://bucket/mysql/
s3cmd sync --exclude-from=/root/s3cmd.exclude --recursive --delete-removed /sites s3://bucket/sites/daily/`echo $(date +"%F")`/
find /var/lib/automysqlbackup/ -name *.sql.gz -mtime +7 -exec rm {} \;