Skip to content

Instantly share code, notes, and snippets.

View hiyali's full-sized avatar
🌎
Looking for opportunities

Salam Hiyali hiyali

🌎
Looking for opportunities
View GitHub Profile
package main
import (
"fmt"
"time"
"sync"
)
func work(serverChan chan int, wg *sync.WaitGroup, server int, thing string) {
defer wg.Done()
@hiyali
hiyali / upload-file-to-amazon-s3-golang.md
Last active August 9, 2024 20:07
Upload file to amazon s3 with s3 filepath on golang

syncer.go

/*
  https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object-acl.html
  https://docs.aws.amazon.com/zh_cn/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
  https://github.com/awslabs/aws-go-wordfreq-sample/blob/master/cmd/uploads3/main.go
  https://docs.aws.amazon.com/sdk-for-go/api/aws/

  1. Create bucket in s3 & get the keys
  - login to UI web aws s3 interface
@hiyali
hiyali / optimize_linux.md
Last active June 9, 2019 06:40
Optimize Linux

Find fd limit:

cat /proc/sys/fs/file-max

Check limit:

ulimit -n
@hiyali
hiyali / After_increase_volume_size.md
Last active March 19, 2019 11:24
After increase volume size

Expand Partition to New Available Disk Volume

$ sudo growpart /dev/xvda 1

Expand file system

$ sudo resize2fs /dev/xvda1
@hiyali
hiyali / cordova-wechat-share-app-delegate.md
Created March 23, 2018 11:27
cordova-wechat-share-app-delegate.md

修改文件AppDelegate+IonicDeeplink.m的openURL方法,内容改成下面的:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    BOOL handled = NO;

    if ([[url absoluteString] rangeOfString:@"liepiao"].location == 0) {
        IonicDeeplinkPlugin *plugin = [self.viewController getCommandInstance:PLUGIN_NAME];
        if(plugin == nil) {
            NSLog(@"Unable to get instance of command plugin");
 }
@hiyali
hiyali / capslock-instead-to-ctrl.md
Last active March 19, 2019 11:21
capslock-instead-to-ctrl

debian, ubuntu etc...

Open the following for editing

sudo nvim /etc/default/keyboard

And edit

XKBOPTIONS="ctrl:swapcaps"

Then, reconfigure:

@hiyali
hiyali / A-lumen-route-resource-example.md
Last active January 1, 2021 02:50
lumen-route-resource

Files

Route

./routes/Resource.php # get model resource
./routes/web.php # include and define resource

Controller

./app/Http/Controllers/RestfulControllerTrait.php # restful trait
./app/Http/Controllers/Controller.php # use restful trait
@hiyali
hiyali / xdebug-install-php7
Created October 9, 2016 11:52 — forked from kamilZ/xdebug-install-php7
Install xdebug from sources php7.0
sudo apt-get install php7.0-dev
wget http://xdebug.org/files/xdebug-2.4.0rc2.tgz
tar -xzf xdebug-2.4.0rc2.tgz
cd xdebug-2.4.0RC2/
phpize
./configure --enable-xdebug
make
sudo cp modules/xdebug.so /usr/lib/.
#FOR FPM
sudo echo 'zend_extension="/usr/lib/xdebug.so"' > /etc/php/7.0/fpm/conf.d/20-xdebug.ini
@hiyali
hiyali / php7-laravel-installation
Last active February 23, 2017 06:25
install php7 and laravel
### install php 7 ###
sudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y
### install laravel ###
composer global require "laravel/installer"
### install requirements ###
sudo apt install php-gd php-zip phpunit php-mbstring
### new project ###