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 / monit
Last active April 28, 2016 11:59
Fresh Install monit from 0 Centos 6.5
#!/bin/bash
#
# Init file for Monit system monitor
# Written by Stewart Adam <s.adam@diffingo.com>
# based on script by Dag Wieers <dag@wieers.com>.
#
# chkconfig: - 98 02
# description: Utility for monitoring services on a Unix system
#
# processname: monit
@clasense4
clasense4 / scrapy
Created February 24, 2016 01:22
Scrapy Regex Unicode Error, got no solution for this
[root@cls rss_crawler]# scrapy crawl news
http://www.focus.de/sport/formel1/formel-1-idol-in-marburger-ausstellung-alles-dreht-sich-um-michael-schumacher-wie-es-ihm-geht-bleibt-ungewiss_id_5292575.html
2016-02-23 20:15:06 [scrapy] INFO: Scrapy 1.0.5 started (bot: rss_crawler)
2016-02-23 20:15:06 [scrapy] INFO: Optional features available: ssl, http11, boto
2016-02-23 20:15:06 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'rss_crawler.spiders', 'SPIDER_MODULES': ['rss_crawler.spiders'], 'BOT_NAME': 'rss_crawler'}
2016-02-23 20:15:06 [scrapy] INFO: Enabled extensions: CloseSpider, TelnetConsole, LogStats, CoreStats, SpiderState
2016-02-23 20:15:06 [boto] DEBUG: Retrieving credentials from metadata server.
2016-02-23 20:15:06 [boto] ERROR: Caught exception reading instance data
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/boto/utils.py", line 210, in retry_url
@clasense4
clasense4 / Multi regex file
Created October 9, 2013 10:42
Simple Regex
phpName="UserID" => phpName.\"[a-z]*\"
@clasense4
clasense4 / tail.html
Created October 8, 2013 02:08
Simple html tail file
</body>
</html>
@clasense4
clasense4 / head.html
Created October 8, 2013 02:03
Simple Head script for markdown, got css from here (https://gist.github.com/andyferra/2554919)
<html>
<head>
<title></title>
<style>
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@clasense4
clasense4 / combine_md.sh
Created October 8, 2013 01:42
Simple Markdown combine
rm body.html
markdown index.md > body.html
cat head.html body.html tail.html > index.html
@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"

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