Skip to content

Instantly share code, notes, and snippets.

View Azhovan's full-sized avatar
🎯
Log the error and degrade gracefully!

Jabar Asadi Azhovan

🎯
Log the error and degrade gracefully!
View GitHub Profile
@Azhovan
Azhovan / vagrant-cheat-sheet.md
Created December 18, 2016 14:22 — forked from wpscholar/vagrant-cheat-sheet.md
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Common Vagrant Commands

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
  • vagrant status -- outputs status of the vagrant machine
  • vagrant halt -- stops the vagrant machine
  • vagrant reload -- restarts vagrant machine, loads new Vagrantfile configuration
  • vagrant provision -- forces reprovisioning of the vagrant machine
@Azhovan
Azhovan / gist:a5d7f1dc5199f53e13609b3f4deabb54
Created May 14, 2017 07:02 — forked from iambigd/gist:10952128
Generating an API Signature - Kayako Developer Resources - Kayako Wiki
<?php
$apiKey = "apikey";
$secretKey = "secretkey";
// Generates a random string of ten digits
$salt = mt_rand();
// Computes the signature by hashing the salt with the secret key as the key
<?php
class DemoSubject implements SplSubject{
private $observer, $value;
public function __construct(){
$this->observers = array();
}
@Azhovan
Azhovan / install.sh
Created November 24, 2017 07:35 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@Azhovan
Azhovan / 1_phpunit-api.md
Created December 3, 2017 13:11 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
@Azhovan
Azhovan / supervisord.conf
Created June 17, 2018 12:04 — forked from jasonamyers/supervisord.conf
A sample supervisor config file
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Note: shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
@Azhovan
Azhovan / gist:6bc7ce4824ab3e0797f42f563af03731
Created February 23, 2019 11:51
Ubuntu minimum sourcelist
deb http://archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe
@Azhovan
Azhovan / time.go
Created September 23, 2019 10:13
golang time utility functions
package util
import (
"time"
)
// convert hour to timestamp
// this function assume the parameter as an hour in a day
@Azhovan
Azhovan / fileChuncker.go
Last active September 23, 2019 15:43
chunk file into smaller pieces
package util
// chunk the file into smaller pieces
func Chunks(path string) (parts uint64, filepath string) {
file := openFile(path)
defer closeFile(file)
fileInfo := fileInfo(file)
@Azhovan
Azhovan / Uppercase-lowercase.go
Last active October 19, 2019 11:14
change single character to Uppercase or lowercase (not unicode)
package main
import (
"bytes"
"fmt"
"unicode"
)
func main() {