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 / MailTemplateParser.php
Created August 29, 2019 08:16
Simple PHP Template Parsing
<?php
class MailTemplateParser
{
protected $_openingTag = '{{';
protected $_closingTag = '}}';
protected $_emailValues;
@ilhamarrouf
ilhamarrouf / example.conf
Last active August 25, 2019 18:03
example virtual host php
server {
listen 80;
server_name example.com;
index index.php;
root /path/to/public;
location / {
try_files $uri /index.php$is_args$args;
}
@ilhamarrouf
ilhamarrouf / README.txt
Last active August 14, 2019 04:00
Setup OCI8 on Centos7
# Stop Apache and uninstall old versions of OCI8.
$ service httpd stop
$ pecl uninstall oci8
$ sudo yum install php-pear php-devel
$ pear download pecl/oci8
# The next commands depend on the version of oci8 downloaded above.
$ tar xvzf oci8-2.2.0.tgz
$ cd oci8-2.2.0/
$ phpize
@ilhamarrouf
ilhamarrouf / command.sh
Created August 12, 2019 07:05
Disable SELinux
setenforce 0
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
@ilhamarrouf
ilhamarrouf / main.go
Created August 8, 2019 06:56
Stateful Goroutines
package main
import (
"fmt"
"math/rand"
"sync/atomic"
"time"
)
type readOp struct {
@ilhamarrouf
ilhamarrouf / config
Created August 7, 2019 09:13
Disabled selinux CentOS 7
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
@ilhamarrouf
ilhamarrouf / main.go
Created August 7, 2019 06:57
for and range provide iteration over basic data structures
package main
import "fmt"
func main() {
// We'll iterate over 2 values in the `queue` channel.
queue := make(chan string, 2)
queue <- "one"
queue <- "two"
@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