Skip to content

Instantly share code, notes, and snippets.


Ryota rkaneko

Block or report user

Report or block rkaneko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rkaneko /
Last active Jan 10, 2019
psql grant, logs configurations
# display privileges
SELECT grantee, privilege_type FROM information_schema.role_table_grants WHERE table_name='some_table_name';

  grantee  | privilege_type
 root      | INSERT
 root      | SELECT
 root      | UPDATE
 root      | DELETE
rkaneko /
Last active Dec 20, 2018
Docker disk trouble shooting

Case: No space left on device error

# remove unnecessary images
docker rm $(docker ps -q -f 'status=exited')
docker rmi $(docker images -q -f "dangling=true")

Case: Volumes are full

rkaneko /
Last active Dec 19, 2018
awk sample for mapping some column values in some .csv file

awk command sample for mapping some column values in some .csv file

$ cat origin.csv

# Case1: We want to all column2 values (e.g. unix timestamp-ish value) to formatted datetime
$ head -1 origin.csv > /dev/stdout && tail origin.csv -n+2 | awk -F "," '{gsub($2, strftime("%Y-%m-%d %H:%M:%S", substr($2, 0, 10))); print}' >> /dev/stdout
rkaneko /
Created Nov 25, 2018
Verify to get Postgresql connection
import logging
import psycopg2
import sys
import traceback
log = logging.getLogger(__file__)
rkaneko / .bashrc.local
Last active Sep 12, 2018
Selecting command history extension using peco on bash
View .bashrc.local
export HISTCONTROL="ignoredups"
_peco_select_history() {
local l=$(HISTTIMEFORMAT= history | tac | sed -e 's/^\s*[0-9]*\+\s\+//' | peco --query "$READLINE_LINE")
bind -x '"\C-r":_peco_select_history'


Boot tmp Kafka

$ docker run --rm -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=localhost --env ADVERTISED_PORT=9092 spotify/kafka

Create topic

rkaneko /
Last active Jul 9, 2018
Docker compose file for terraform CLI.
rkaneko /
Created Jun 26, 2018
Check the number is divisible by divisor number considering decimal numbers.
from decimal import Decimal
import numbers
import unittest
def is_divisible(num, divisor):
assert isinstance(num, numbers.Number)
assert isinstance(divisor, numbers.Number)
quotient = Decimal(str(num)) / Decimal(str(divisor))
rkaneko / getCustomProperty.ts
Last active Jun 9, 2018
Get CSS custom property value by name via JavaScript.
View getCustomProperty.ts
function getCustomProperty(name: string): string {
const style = window.getComputedStyle(document.documentElement);
return style.getPropertyValue(name).trim();
rkaneko / default.conf
Created Oct 3, 2017
Dockerized nginx's proxy config example using variables for proxy_pass
View default.conf
server {
listen 80 default_server;
# real_ip_header X-Forwarded-For
# server_name localhost;
location ~ ^/graphql(.*) {
# see
resolver ipv6=off;
set $target http://${SOME_HOST}:${SOME_PORT}/graphql;
You can’t perform that action at this time.