#!/usr/bin/env bash
if [ ! -f /tmp/linux ]; then
curl -sS https://www.linux.org.ru/ | egrep -o /tag/[0-9a-z-]+ | sed 's|/tag/||' > /tmp/linux
fi
if [ ! -f /tmp/pron ]; then
curl -sS http://www.xvideos.com/tags | egrep -o /tags/[a-z0-9-]+ | sed 's|/tags/||' > /tmp/pron
fi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
influxdb: | |
image: influxdb:1.2.0-alpine | |
ports: | |
- 8083:8083 | |
- 8086:8086 | |
- 8088:8088 | |
volumes: | |
- "$PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
<style> | |
/* CSS Document */ | |
body { | |
font:12px arial; | |
color: #222; | |
text-align:center; | |
padding:35px; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
ActiveRecord::Base.establish_connection({ | |
adapter: 'postgres', # or mysql2 | |
host: 'localhost', | |
username: 'username', | |
password: 'password', | |
database: 'dbname', | |
}) | |
# ActiveRecord::Base.establish_connection("postgres://username:password@host/dbname") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Haskell Mergesort | |
- Copyright (C) 2014 by Kendall Stewart | |
First we define a couple of helper functions that | |
will be useful in splitting the list in half: | |
> fsthalf :: [a] -> [a] | |
> fsthalf xs = take (length xs `div` 2) xs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func merge(left []int, right []int) []int { | |
var result []int | |
for len(left) != 0 && len(right) != 0 { | |
if left[0] < right[0] { | |
result = append(result, left[0]) | |
left = left[1:] |
What is sync.Pool in golang and How to use it
sync.Pool (1/2)
Many Go libraries include custom thread-safe free lists, like this:
var objPool = make(chan *Object, 10)
func obj() *Object {
select {
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func yield(count int) chan int { | |
ch := make(chan int) | |
go func() { | |
for i := 0; i < count; i++ { | |
ch <- i | |
} | |
close(ch) | |
}() | |
return ch | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"io/ioutil" | |
"github.com/labstack/echo" | |
"github.com/labstack/echo/engine/standard" | |
mw "github.com/labstack/echo/middleware" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
func main() { | |
doneCh := make(chan bool) |