lets fix the ubuntu locale issue (digitalocea.com droplets)
1. step, browse locale settings
root@piklook-dev:~# locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
<?php | |
/** | |
* Countries List | |
* @return array | |
*/ | |
function countries() | |
{ | |
$countries = Array( | |
'AF' => 'Afghanistan', |
" File-type highlighting and configuration. | |
" Run :filetype (without args) to see what you may have | |
" to turn on yourself, or just set them all to be sure. | |
syntax on | |
filetype on | |
filetype plugin on | |
filetype indent on | |
" Intuitive backspacing in insert mode | |
set backspace=indent,eol,start |
<?php | |
/** | |
* Get value of index in fibonacci series | |
* | |
* @author Ali OYGUR <[email protected]> | |
* @param int $n index number | |
* @return int value of index | |
*/ | |
function fibonacci($n) | |
{ |
#!/bin/bash | |
echo Removing $1 from denyhosts tables | |
WORK_DIR=/var/lib/denyhosts/ | |
IP=`echo $1 | sed 's/\./\\\\./g'` | |
service denyhosts stop | |
eval "sed -i /$IP/d /etc/hosts.deny" | |
eval "sed -i /$IP/d ${WORK_DIR}hosts" | |
eval "sed -i /$IP/d ${WORK_DIR}hosts-restricted" | |
eval "sed -i /$IP/d ${WORK_DIR}hosts-root" | |
eval "sed -i /$IP/d ${WORK_DIR}hosts-valid" |
lets fix the ubuntu locale issue (digitalocea.com droplets)
1. step, browse locale settings
root@piklook-dev:~# locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
<?php | |
/** | |
* Creating date collection between two dates | |
* | |
* <code> | |
* <?php | |
* # Example 1 | |
* date_range("2014-01-01", "2014-01-20", "+1 day", "m/d/Y"); | |
* |
#!/bin/bash | |
sudo fallocate -l 4G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
echo "Added!" | |
free -m |
package main | |
import ( | |
"encoding/json" | |
"log" | |
"net/http" | |
"reflect" | |
"time" | |
"github.com/gorilla/context" |
package main | |
import ( | |
"net/http" | |
"net/http/httputil" | |
"net/url" | |
) | |
func main() { | |
u, _ := url.Parse("https://leanfoods-9f12.restdb.io") |
this algorithm 10x faster than https://www.dotnetperls.com/duplicates-go and zero allocation
➜ api git:(master) ✗ go test -v -bench=. main_test.go
=== RUN TestSliceUniq
--- PASS: TestSliceUniq (0.00s)
BenchmarkSliceUniq-4 3000000 439 ns/op 0 B/op 0 allocs/op
BenchmarkRemoveDuplicates-4 500000 4599 ns/op 571 B/op 8 allocs/op
PASS