Skip to content

Instantly share code, notes, and snippets.

View AidHamza's full-sized avatar
:shipit:

Aid Hamza AidHamza

:shipit:
View GitHub Profile
@AidHamza
AidHamza / iterm2-solarized.md
Created January 20, 2016 22:19 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

Solarized

@AidHamza
AidHamza / postgres-cheatsheet.md
Created March 30, 2017 12:03 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

[example.org]
listen = /srv/vhtdocs/example.org/log/.php-fpm.sock
listen.owner = example_org
listen.group = www-data
listen.mode = 0660
user = example_org
group = example_org
pm = dynamic
@AidHamza
AidHamza / postgres_queries_and_commands.sql
Last active August 30, 2017 15:38 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- Good reference : http://big-elephants.com/2013-09/exploring-query-locks-in-postgres/
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
@AidHamza
AidHamza / console.sh
Created October 24, 2017 23:40 — forked from nakamuraagatha/console.md
Install Laravel C9.io php 7.1 with Laravel Horizon
## Install with PHP 7.1
```
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.1
sudo a2dismod php5
sudo a2enmod php7.1
sudo apt-get install php7.1-dom php7.1-mbstring php7.1-zip php7.1-gd php7.1-xml php7.1-gmp php7.1-mysql php7.1-sqlite php7.1-mcrypt php7.1-curl
```
@AidHamza
AidHamza / safebuffer.go
Created November 5, 2017 00:20 — forked from arkan/safebuffer.go
Golang: Buffer is a goroutine safe bytes.Buffer
package safebuffer
import (
"bytes"
"sync"
)
// Buffer is a goroutine safe bytes.Buffer
type Buffer struct {
buffer bytes.Buffer
@AidHamza
AidHamza / 100_base.conf
Created November 13, 2017 14:56 — forked from danackerson/100_base.conf
using nginx + lua + redis for redirects and rewrites
# using such a setup requires `apt-get install lua-nginx-redis` under Ubuntu Trusty
# more info @ http://wiki.nginx.org/HttpLuaModule#access_by_lua
http {
lua_package_path "/etc/nginx/include.d/?.lua;;";
lua_socket_pool_size 100;
lua_socket_connect_timeout 10ms;
lua_socket_read_timeout 10ms;
server {
@AidHamza
AidHamza / introrx.md
Created November 22, 2017 15:20 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@AidHamza
AidHamza / build.sh
Created December 28, 2018 11:29 — forked from apremalal/build.sh
Exclude vendor directory from goimports, go fmt,go install, go test ...
echo 'Formatting the code base...'
godep go fmt $(go list ./... | grep -v /vendor/)
echo 'Optimizing the imports...'
goimports -w $(go list -f {{.Dir}} ./... | grep -v /vendor/)
echo 'Installing dependencies. This might take some time...'
godep go install $(go list ./... | grep -v /vendor/)
echo "Executing test"
@AidHamza
AidHamza / Dice.sol
Created June 6, 2023 08:13 — forked from apogiatzis/Dice.sol
Dice rolling game smart contract skeleton
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/IERC20.sol";
contract Dice {
IERC20 public nativeGameToken;
mapping(address => UserBet) private userBets;
struct UserBet {