Skip to content

Instantly share code, notes, and snippets.

@recoilme
recoilme / ibolt.go
Created April 27, 2017 10:08
Rest api to bolt db
/*
Rest api 2 boltdb
PUT:
# params
host/database/backet/key
and value in body
curl -X PUT -H "Content-Type: application/octet-stream" --data-binary "@durov.jpg" localhost:5000/bolt/images/durov
curl -X PUT -H "Content-Type: text/html" -d '{"username":"xyz","password":"xyz"}' localhost:5000/bolt/users/user1
@recoilme
recoilme / async_fetcher.go
Last active May 25, 2017 17:09
async url fetcher with timeouts
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"time"
)
@recoilme
recoilme / index.html
Last active November 20, 2017 13:56
startupoftheday
<!doctype html>
{{ $host := .Host}}
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Стартап дня - #стартапдня</title>
<meta name="description" content="{{.Description}}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
@recoilme
recoilme / checkTelegramAuthorization.go
Created February 14, 2018 07:32
Check Telegram Authorization in golang
// check telegram authorization on golang
//php version: https://gist.github.com/anonymous/6516521b1fb3b464534fbc30ea3573c2#file-check_authorization-php
//usage:
/*
func TestTg(t *testing.T) {
data := "id=1263310&first_name=Vadim&last_name=Kulibaba&username=recoilme&photo_url=https://t.me/i/userpic/320/recoilme.jpg&auth_date=1518535618&hash=1d7069137bf517a63261ee156919a057dca93a416118eebfd0d8f5697442cdce"
token := "YOUR:TOKEN"
if !checkTelegramAuthorization(data, token) {
t.Fail()
}
@recoilme
recoilme / css-glitched-text.markdown
Created September 4, 2018 15:37
CSS Glitched Text
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"strings"
"time"
package main
import (
"errors"
"flag"
"fmt"
"log"
"net"
"net/textproto"
"os"
package main
import (
"fmt"
"math/rand"
"os"
"runtime"
"time"
"encoding/json"