Skip to content

Instantly share code, notes, and snippets.

View hassansin's full-sized avatar
👋
Working from home

Hassansin hassansin

👋
Working from home
View GitHub Profile
@hassansin
hassansin / aspell-add-words.sh
Last active February 8, 2019 11:47
aspell add words to dictionary
touch ~/aspell.personal.txt
vi ~/aspell.personal.txt # add words per line
aspell --lang=en create master /tmp/en-personal.pws < ~/aspell.personal.txt
cp /tmp/en-personal.pws /usr/lib/aspell
vim /usr/lib/aspell/en_US.multi # add the line: 'add en-personal.pws'
@hassansin
hassansin / commands.sh
Last active May 23, 2018 11:41
Web Server Performance Comparison #sysbench #benchmark
# Ref: http://wiki.mikejung.biz/Sysbench
# CPU
sysbench --test=cpu --cpu-max-prime=20000 run
sysbench --test=cpu --cpu-max-prime=20000 run --num-threads=4
#FILE IO
sysbench --test=fileio --file-total-size=4G prepare
sysbench --test=fileio --file-total-size=4G --file-test-mode=rndrw --max-time=300 --max-requests=0 --file-extra-flags=direct run
sysbench --test=fileio --file-total-size=4G cleanup
/*Use Fiddler Proxy*/
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888');
/*Use Proxy*/
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, "IP:PORT");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password");
@hassansin
hassansin / send-to-kindle.js
Created September 22, 2017 09:52
Webtask to send any Webpage to Kindle as PDF
'use latest';
import nodemailer from 'nodemailer@2.5.0';
import request from 'request@2.81.0';
module.exports = function(context, cb) {
const url = context.query.url;
const kindleAddress = context.query.address || context.secrets.KINDLE_ADDRESS;
if (!url) {
return cb(null, "missing url parameter");
@hassansin
hassansin / laravel-debugging.md
Last active July 2, 2017 22:00
Laravel Debugging #laravel #debugging
Get Query Logs
DB::enableQueryLog();
dd(DB::getQueryLog()); #output last executed queries
DB::table('users')->toSql() #show the generated sql statement 
DB::table('users')->getQuery()->wheres #show wheres conditions
Debug Messages with DebugBar
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdn.jsdelivr.net/lodash/4/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/2.1.3/benchmark.min.js"></script>
</head>
<body>
@hassansin
hassansin / send.js
Created September 26, 2016 00:49
Send Joke with AWS SNS
#!/usr/bin/env node
/**
* Send a Joke to your mobile using AWS SNS service
* Usage:
* ./send.js phoneNumber [firstName] [lastName]
*
*/
const http = require('http');
@hassansin
hassansin / .block
Last active March 9, 2016 23:32
D3 Chronograph Stopwatch
license: gpl-3.0
height: 300
border: no
@hassansin
hassansin / apiary.apib
Created December 24, 2015 03:55
Blueprint Circular Reference Error
FORMAT: 1A
HOST: https://api-sandbox.foxycart.com
# FoxyCart
# FoxyCart API Root [/]
## API starting point [GET]
+ Request
@hassansin
hassansin / casper-js-on-comple-error.js
Created July 31, 2015 13:51
CasperJS onComplete called infinitely when exitOnError is false.
var casper = require('casper').create({
viewportSize: {
width: 1024,
height: 768
},
pageSettings: {
webSecurityEnabled: false
},
exitOnError: false,
waitTimeout: 70000