Skip to content

Instantly share code, notes, and snippets.

Slawomir Jasinski slav123

Block or report user

Report or block slav123

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@slav123
slav123 / null.php
Last active Aug 13, 2019
Null coalescing operator
View null.php
<?php
// Fetches the value of $_GET['user'] and returns 'nobody'
// if it does not exist.
$username = $_GET['user'] ?? 'nobody';
// This is equivalent to:
$username = isset($_GET['user']) ? $_GET['user'] : 'nobody';
// Coalescing can be chained: this will return the first
// defined value out of $_GET['user'], $_POST['user'], and
@slav123
slav123 / go-install.sh
Last active Jul 10, 2019 — forked from mlabouardy/go-install.sh
Setup Go environment variables
View go-install.sh
# GOROOT is the location where Go package is installed on your system
export GOROOT=/usr/lib/golang
# GOPATH is the location of your work directory
export GOPATH=$HOME/go
# PATH in order to access go binary system wide
export PATH=$PATH:$GOROOT/bin
@slav123
slav123 / sub.go
Created May 29, 2019
AWS SNS SubscriptionConfirmation
View sub.go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
const subConfrmType = "SubscriptionConfirmation"
@slav123
slav123 / keylock.ino
Created Mar 6, 2019
Arduino double relay keypad lock
View keylock.ino
#include <Keypad.h>
#define PasswordLength 5
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{'1','2','3', 'A'},
{'4','5','6', 'B'},
{'7','8','9', 'C'},
@slav123
slav123 / aupostcode2state.js
Created Jul 24, 2018
Australian Postcode to state conversion
View aupostcode2state.js
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
full website wget
View 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/
@slav123
slav123 / gist:2075589367aa526cce6ef0aaf68aba75
Created Mar 8, 2018 — forked from bds/gist:2207826
Convert files from .scss to .sass
View gist:2075589367aa526cce6ef0aaf68aba75
sass-convert -F scss -T sass application_styles.css.scss application_styles.css.sass
@slav123
slav123 / post.go
Created Mar 5, 2018
send data via POST golang
View post.go
package main
import (
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
)
@slav123
slav123 / bash.sh
Created Mar 4, 2018
redis php directadmin
View bash.sh
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
You can’t perform that action at this time.