Skip to content

Instantly share code, notes, and snippets.

@aisensiy
aisensiy / run.sh
Created July 30, 2020 08:11
访问集群内的 mysql
#!/bin/bash
# kubectx -> dev env
kubectx
# kubens -> infra
kubens
# list service use openbayes-mysql-master
kubectl get svc
@aisensiy
aisensiy / run.sh
Created June 30, 2020 15:39 — forked from dehamzah/run.sh
Create read only mysql database user
# Login
$ mysql -u root -p
# Check privileges
$ SHOW GRANTS FOR 'read-only_user_name'@'%';
# Remove the privileges if any
$ REVOKE ALL PRIVILEGES ON database_name.* FROM 'read-only_user_name'@'%';
@aisensiy
aisensiy / main.go
Created January 17, 2019 14:42
Jwt in Golang
package main
import (
"fmt"
jwt "github.com/dgrijalva/jwt-go"
)
func main() {
// sample token string taken from the New example
DEBU[0000] events| BuildStarted
DEBU[0000] options| AWSOptions *core.AWSOptions
DEBU[0000] options| AWSAccessKeyID string =
DEBU[0000] options| AWSRegion string = us-east-1
DEBU[0000] options| AWSSecretAccessKey string =
DEBU[0000] options| S3Bucket string = wercker-development
DEBU[0000] options| S3PartSize int64 = 104857600
DEBU[0000] options| ApplicationID string = getting-started-nodejs
DEBU[0000] options| ApplicationName string = getting-started-nodejs
DEBU[0000] options| ApplicationOwnerName string = wercker
@aisensiy
aisensiy / docker-info
Created June 13, 2016 14:17
docker-info
Containers: 4
Images: 28
Server Version: 1.11.2
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 109
Dirperm1 Supported: true
Logging Driver: json-file
Kernel Version: 4.2.0-18-generic
@aisensiy
aisensiy / purge.sh
Last active March 16, 2016 10:19 — forked from adrienbrault/purge.sh
Script to reduce VM size before packaging for vagrant
#!/bin/bash
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
# save this file to ~/.gitconfig
[core]
editor = vim
[user]
name = YOUR_NAME
email = YOUR_EMAIL
[alias] # here is some alias to make your git more powerful
st = status
di = diff
co = checkout
#!/usr/bin/python
# -*- encoding: UTF-8 -*-
import codecs
import sys
from math import log
from collections import defaultdict
class Trie (object):
class TrieNode:
#!/usr/bin/env bash
# Pre-requisites
sudo apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim
curl -L https://www.opscode.com/chef/install.sh | sudo bash
# The rest
sudo gem install ruby-shadow --no-ri --no-rdoc
@aisensiy
aisensiy / quicksetup
Last active December 23, 2015 08:49
Init setup script for ubuntu
sudo apt-get update
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion ruby ncurses-term mercurial ruby-dev exuberant-ctags libnotify-bin curl autoconf make automake ssh openjdk-6-jdk git-core git-doc imagemagick postgresql-contrib libpq-dev -y
sudo apt-get install mysql-server mysql-client -y
sudo apt-get install libmysql-ruby libmysqlclient-dev -y
git config --global user.name <YOUR USERNAME>
git config --global user.email <YOUR EMAIL>
ssh-keygen -t rsa -C <YOUR EMAIL>
# if you use ruby
curl -L https://get.rvm.io | bash -s stable --rails
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc