Skip to content

Instantly share code, notes, and snippets.

View schaternik's full-sized avatar

Anastasia schaternik

  • Berlin, Germany
  • 16:15 (UTC +02:00)
View GitHub Profile
@schaternik
schaternik / main.go
Created November 19, 2019 10:42
Graphql server in go with Graphiql handling one query
package main
import (
"net/http"
"github.com/friendsofgo/graphiql"
graphql "github.com/graph-gophers/graphql-go"
"github.com/graph-gophers/graphql-go/relay"
)
package main
import (
"fmt"
"io"
"os"
"path"
)
func dirTree(out io.Writer, root string, printFiles bool) error {
@schaternik
schaternik / .editorconfig
Created February 28, 2019 23:57
Sample editor config file
# https://editorconfig.org/#example-file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
@schaternik
schaternik / secret-key-base.rb
Last active February 6, 2019 13:48
Generate secreta key base like rails does it in IRB
require 'securerandom'
puts SecureRandom.hex(64)
comment = "# frozen_string_literal: true\n"
filemode = "r+"
dirs = Dir[Rails.root.join('spec/**/*.rb').to_s] + Dir[Rails.root.join('lib/**/*.rake').to_s] + Dir[Rails.root.join('lib/**/*.rb').to_s]
dirs.each do |filename|
contents = File.open(filename, "r") do |f|
f.read
end
contents = comment + contents
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: alabama_song
password: 1
development:
<<: *default
database: alabama_song_development
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
development:
<<: *default
@schaternik
schaternik / regional-setting.md
Last active August 29, 2015 14:22
Set up Regional Settings with command line in Linux
@schaternik
schaternik / pg_hba.conf
Last active February 12, 2018 13:22
Postgresql setup
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
@schaternik
schaternik / mysql.md
Last active February 12, 2018 13:25
Mysql CLI
  • check my sql installation mysql -V

  • login as root mysql -u root -p

  • SELECT User FROM mysql.user; - get list of the all database users

  • CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; - create new use with specified password

  • GRANT ALL PRIVILEGES ON * . * TO 'aska'@'localhost'; - grant the all privileges

  • vim /etc/mysql/my.cnf - mysql config file

  • sudo /etc/init.d/mysql restart