Skip to content

Instantly share code, notes, and snippets.

View clasense4's full-sized avatar
🎯
Focusing

Fajri Abdillah clasense4

🎯
Focusing
View GitHub Profile
@clasense4
clasense4 / candy_tutorial.md
Last active August 29, 2015 14:05
Install Candy (Realtime Chat)
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@clasense4
clasense4 / mysql_csv.md
Created December 1, 2014 09:48
MySQL Insert Data from CSV

Intro

Well, for hours i have been so frustated why my insert file does not work, so this is the solution.

I use MariaDB 10.0.14

LOAD DATA local INFILE "/tmp/pengguna.csv"  INTO TABLE pengguna_dapodik_tokudb FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\r\n' ( `username`, `password`, `nama`, `sekolah_id`, `sekolah_nama`, `kabupaten_kota_id`, `kabupaten_kota_nama`, `propinsi_id`, `propinsi_nama` );
@clasense4
clasense4 / instruction.md
Created December 3, 2014 01:16
Simple Nginx maintenance script

Simple Nginx Maintenance Script

Well, I'm too lazy to doing some command just for change the configuration, here is the script. The logic is simple, change app port from 80 into 8313, and make the port 80 maintenance. And to revert it, change app port from 8313 into 80, and make the maintenance.conf disable by change it into extension .confs.

To use it, make sure the filename just look like below, and then chmod a+x *.sh. Then ./maintenance.sh to make it maintenance mode or ./demaintenance.sh to revert.

maintenance.sh

#!/bin/bash
# @name     : Maintenance script for CRM App

sysbench result

[root@sim2-p2tk ~]# time sysbench --test=/usr/share/doc/sysbench/tests/db/oltp.lua --mysql-table-engine=innodb --oltp-table-size=250000 --mysql-user=testdb --mysql-password=testpw --mysql-socket=/var/lib/mysql/mysql.sock prepare
sysbench 0.5:  multi-threaded system evaluation benchmark

Creating table 'sbtest1'...
Inserting 250000 records into 'sbtest1'

real    0m11.455s
user    0m3.805s
@clasense4
clasense4 / website.md
Last active April 4, 2018 06:56
Penjelasan tentang website, menurut pribadi

Website

Website Company Profile

Pendahuluan

Ini adalah website untuk sebuah perusahaan, umumnya untuk menjelaskan sebuah perusahaan, bergerak di bidang apa, apa yang dikerjakannya, dll. Ini adalah informasi yang dapat dipergunakan sebagai pengganti kartu nama. Bayangkan jika kita mendapatkan sebuah pekerjaan dari perusahaan XXX, yang pasti ada dalam benak kita, yaitu mencari info tentang perusahaan tersebut. Salah satu cara nya yaitu mencari website perusahaan tersebut. Website perusahaan harus dapat menjelaskan secara singkat padat dan jelas tentang perusahaan itu.

Style website bisa bermacam - macam, bisa berupa halaman, atau sebuah halaman yang panjang, atau dikombinasikan. Fitur umum nya yaitu halaman statis (tidak berpengaruh terhadap tanggal) seperti about, product, service dan contact, blog (di urut berdasarkan tanggal terbaru di paling atas), halaman pricing (tapi bukan ecommerce).

Contoh website :

@clasense4
clasense4 / Scrapy.md
Last active March 5, 2017 05:04
Install Scrapy 0.16.0 on Centos 6.6
yum install python-pip -y
yum install python-devel -y
yum install gcc gcc-devel -y
yum install libxml2 libxml2-devel -y
yum install libxslt libxslt-devel -y
yum install openssl openssl-devel -y
yum install libffi libffi-devel -y
CFLAGS="-O0"  pip install lxml
pip install Scrapy==0.16.0
@clasense4
clasense4 / backup.sh
Created June 16, 2015 23:10
Simple backup file use it with crontab
#!/bin/sh
now="$(date +'%Y_%m_%d_%H_%M')"
filename_app="CRM_APP_$now".tar.gz
filename_db="CRM_DB_$now".sql.gz
backupfolder="/home/backup"
backupfolder_app="/var/www/website"
fullpathbackupfile_db="$backupfolder/$filename_db"
fullpathbackupfile_app="$backupfolder/$filename_app"
# execute mysql
mysqldump -u user -pPasswd -h xxx.xxx.xxx.xxx databases | gzip -9 > "$fullpathbackupfile_db"
@clasense4
clasense4 / CustomerCest.php
Last active September 26, 2018 06:33
Yii2 + Codeception Cookie & Session problem / error, still got no solution for this. The cookie / session won't be share between tests (function). [Edit] check acceptance.yml
<?php
// use tests\codeception\backend\AcceptanceTester;
use tests\codeception\backend\acceptance\BaseStep;
class CustomerCest
{
public $user = 'Fajri';
// private $cookie = 'xyz';