Skip to content

Instantly share code, notes, and snippets.

View Glavic's full-sized avatar

Glavić Glavic

View GitHub Profile
@Glavic
Glavic / main.go
Last active February 2, 2018 15:18
`req.URL.Path` is always empty?
package main
import (
"log"
"net/http"
"regexp"
"github.com/elazarl/goproxy"
)
@Glavic
Glavic / main.go
Created August 11, 2017 13:42
How to set SET NAMES and SET TIME_ZONE ?
package main
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"log"
)
func main() {
db, err := sqlx.Connect("mysql", "user:pass@/test")
@Glavic
Glavic / main.go
Created June 15, 2017 05:58
dial tcp 127.0.0.1:3306: connectex: Only one usage of each socket address (protocol/network address/port) is normally permitted.
package main
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"log"
"sync"
)
var (
@Glavic
Glavic / main.cpp
Created November 3, 2016 07:24
YT-tutorial-6
// https://www.youtube.com/watch?v=b381xvbp6pw
#include "mbed.h"
DigitalOut ledGreen(LED1);
DigitalOut ledBlue(LED2);
DigitalOut ledRed(LED3);
DigitalIn UserButton(USER_BUTTON);
Serial pc(USBTX, USBRX);
int main() {
@Glavic
Glavic / rndimg.php
Created September 13, 2016 19:04
Display random image from a directory in a standard img src using php
<?php
$folder = realpath('img_path');
if ($folder) {
$folder .= DIRECTORY_SEPARATOR;
}
$extList = array(
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',