Skip to content

Instantly share code, notes, and snippets.

View slav123's full-sized avatar

Slawomir Jasinski slav123

View GitHub Profile
@slav123
slav123 / aupostcode2state.js
Created July 24, 2018 11:01
Australian Postcode to state conversion
function returnState(postcode) {
var postcode = parseInt(postcode, 10);
if ((postcode >= 1000 && postcode <=1999) || (postcode >= 2000 && postcode <= 2599) || (postcode >=2619 && postcode <= 2899) || (postcode >= 2921 && postcode <= 2999)){
return 'NSW';
} else if ((postcode >= 200 && postcode <= 299) || (postcode >= 2600 && postcode <= 2618) || (postcode >= 2900 && postcode <= 2920)) {
return 'ACT';
} else if ((postcode >= 3000 && postcode <= 3999) || (postcode >= 8000 && postcode <= 8999)) {
return 'VIC';
} else if ((postcode >= 4000 && postcode <= 4999) || (postcode >= 9000 && postcode <= 9999)) {
return 'QLD';
@slav123
slav123 / wget
Created May 28, 2018 12:24
full website wget
wget --recursive --no-clobber --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains webthemez.com --no-parent https://webthemez.com/demo/custom-best-interior-design-website-template/
set ssl:verify-certificate no
@slav123
slav123 / gist:2075589367aa526cce6ef0aaf68aba75
Created March 8, 2018 09:45 — forked from bds/gist:2207826
Convert files from .scss to .sass
sass-convert -F scss -T sass application_styles.css.scss application_styles.css.sass
@slav123
slav123 / post.go
Created March 5, 2018 12:00
send data via POST golang
package main
import (
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
)
@slav123
slav123 / bash.sh
Created March 4, 2018 12:01
redis php directadmin
wget https://github.com/phpredis/phpredis/archive/develop.zip
unzip develop.zip
cd phpredis-develop/
/usr/local/php70/bin/phpize
./configure --with-php-config=/usr/local/php70/bin/php-config
make && make install
/usr/local/php70/lib/php.conf.d/
cp 10-opcache.ini 10-redis.ini
@slav123
slav123 / caddy.conf
Created March 3, 2018 07:24
Caddy with features
pricewatch.io www.pricewatch.io 104.198.194.205 {
#startup service php70-php-fpm start
#shutdown service php70-php-fpm stop
expires {
match .css$ 1m # expires
match .js$ 1m # expires
match .png$ 1m # expires
match .jpg$ 1m #expires # expires
match .webp$ 1m
@slav123
slav123 / rename.sh
Created January 8, 2018 06:01
batch raname max os x
for f in *.png; do echo mv "$f" "${f/_*_/_}"; done
@slav123
slav123 / move.sh
Created January 8, 2018 01:57
find files in subdirectories and move to one location
find ./ -name '*.JPG' -exec cp {} /Volumes/NO\ NAME/2014 \;
@slav123
slav123 / main.go
Created January 7, 2018 23:50
update JPG file modification date using EXIF data
package main
import (
"fmt"
"github.com/rwcarlsen/goexif/exif"
"io/ioutil"
"os"
"path"
"path/filepath"
)