Skip to content

Instantly share code, notes, and snippets.

View vmpartner's full-sized avatar

Musin Vitaly vmpartner

  • Russia
View GitHub Profile
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
// by using KingPin
sSep = app.Flag("separator", "Separator to use in csv file (in read and write) [default is ','].").Short('s').Default(",").String()
// Need to cast *sSep in rune for option Comma in "encoding/csv"
w.Comma = bytes.Runes([]byte(*sSep))[0] // fr => converti la chaine en tableau de bytes, pour apres la convertir en rune
@fatih
fatih / set.go
Created August 11, 2013 21:05
Concurrent safe SET data structure in Go (Golang)
// A very simple example about how to use concurrent-safe SETs (using string as keys) in GO
package main
import (
"fmt"
"sync"
)
type Set struct {
m map[string]bool
@rais38
rais38 / gist:5766980
Created June 12, 2013 16:35
Create patch from stash
git stash show -p stash@{0} > Stash0.patch
@akost
akost / convert.sh
Created April 4, 2012 19:06
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do