Skip to content

Instantly share code, notes, and snippets.

View ilhamarrouf's full-sized avatar
🏠
Working from home

Ilham Arrouf ilhamarrouf

🏠
Working from home
View GitHub Profile
@ilhamarrouf
ilhamarrouf / main.go
Created August 7, 2019 05:17
We can use channels to synchronize execution across goroutines. Here’s an example of using a blocking receive to wait for a goroutine to finish. When waiting for multiple goroutines to finish, you may prefer to use a WaitGroup.
package main
import "fmt"
import "time"
func worker(done chan bool) {
fmt.Print("working...")
time.Sleep(time.Second)
fmt.Println("done")
@ilhamarrouf
ilhamarrouf / main.go
Created August 7, 2019 05:15
To wait for multiple goroutines to finish, we can use a wait group.
// To wait for multiple goroutines to finish, we can
// use a *wait group*.
package main
import (
"fmt"
"sync"
"time"
)
@ilhamarrouf
ilhamarrouf / command.sh
Created July 24, 2019 15:23
Setup Php Composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=/usr/bin --filename=composer
@ilhamarrouf
ilhamarrouf / docker-compose.yml
Created May 28, 2019 04:00 — forked from sen0rxol0/docker-compose.yml
Nuxt.js with SSR featuring “Docker Multi-stage build” and “node-prune"
version: '3.5'
services:
app:
build: .
volumes:
- '.:/app'
ports:
- '3000:80'
environment:
@ilhamarrouf
ilhamarrouf / command.sh
Created April 19, 2019 23:39
PHP Modul
php php-cli php-curl php-intl php-mbstring php-xml php-zip php-bcmath php-cli php-fpm php-imap php-json php-opcache php-apcu php-xmlrpc php-bz2 php-common php-gd php-ldap php-mysql php-pgsql php-readline php-soap php-tidy php-xsl php-apcu php-mcrypt php-fileinfo
@ilhamarrouf
ilhamarrouf / nginx.conf
Last active March 10, 2021 09:39
Nginx Config
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
@ilhamarrouf
ilhamarrouf / default.vcl
Created April 18, 2019 02:53
Varnish Default Config
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.
@ilhamarrouf
ilhamarrouf / command.sh
Created April 2, 2019 09:36
SSH socks proxy
ssh -N -p 22 -D 8000 root@10.1.1.116
@ilhamarrouf
ilhamarrouf / main.go
Created March 29, 2019 11:53
Golang rate limiting
package main
import (
"fmt"
"time"
)
func main() {
requests := make(chan int, 5)
@ilhamarrouf
ilhamarrouf / main.go
Last active March 29, 2019 11:52
Outer loop matrix golang
package main
import "fmt"
func main() {
outerLoop:
for i := 0; i < 5; i++ {
for j := 0; j < 5; j++ {
if i == 5 {
break outerLoop