Skip to content

Instantly share code, notes, and snippets.

View vaijab's full-sized avatar

Vaidas Jablonskis vaijab

View GitHub Profile
# Samples: 4K of event 'cycles:ppp'
# Event count (approx.): 127052685112
#
# Children Self Command Shared Object Symbol
# ........ ........ ............... ......................................... .......................................................................................................
#
25.49% 0.00% swapper [kernel.kallsyms] [k] secondary_startup_64
|
---secondary_startup_64
|
@vaijab
vaijab / protoc-install.sh
Last active February 5, 2018 16:38
protoc one-liner install
export PROTOC_VERSION=3.5.1
wget -q https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip -O /tmp/protoc-${PROTOC_VERSION}.zip && unzip -d /usr /tmp/protoc-${PROTOC_VERSION}.zip
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: drone-agent-github
spec:
replicas: 5
template:
metadata:
labels:
m.Clusters.On("GetClusters", cluster.Name).Return([]*model.Cluster{}, nil).Once()
m.Clusters.On("CreateClusterInfra", cluster).Return(nil)
m.Clusters.On("PushAssets", cluster.Name, model.Assets{}).Return(nil)
// At this point the cluster already exists.
m.Clusters.On("GetClusters", cluster.Name).Return([]*model.Cluster{&cluster}, nil).Once()
type Foo struct {
Name string
Number interface{} // Optional field
}
// SQL
CREATE TABLE foo (
name VARCHAR(255),
number INTEGER // Sometimes it is actually NULL
)
~/gocode/drone-trigger/src/github.com/vaijab/drone-trigger> time ./drone-trigger --help
NAME:
drone-trigger - trigger drone builds or deployments
USAGE:
drone-trigger [global options] command [command options] [arguments...]
VERSION:
0.0.1
@vaijab
vaijab / aws_limit_exceeded_retry.sh
Created January 19, 2016 14:14
aws cli: retry on RequestLimitExceeded error
#!/usr/bin/bash
function retry() {
tries=0
max_tries=3
sleep_sec=1
exit_code=256
error=''
until { error=$(${@} 2>&1 1>&${stdout}); } {stdout}>&1; do
@vaijab
vaijab / etcd2-restore.sh
Created January 7, 2016 22:21
etcd2 data restore script
#!/usr/bin/bash
: ${1?"etcd2 protocol has not been set. Specify http or https as first argument."}
: ${2?"etcd2 data dir has not been set. Specify as second argument."}
source /etc/environment
sudo systemctl stop etcd2.service
sudo rm -rf ${2}/member
@vaijab
vaijab / dir2indexhtml.sh
Created December 28, 2015 21:26
Create index.html file listing from a given directory
#!/usr/bin/bash
if [[ -d ${1} ]]; then
path="${1}/"
files="${path}*"
elif [[ -f ${1} ]]; then
files="${1}"
# Else fallback to finding files in current directory
elif [[ ${#} -eq 0 ]]; then
files="*"
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyQjhtz0tZyJSztECvRixSZNSRg89Cog25z5bZNEYzHWwzAM/Jr0Rm1+0J3VI+AFazS2spEeMLYUcxw9HcHceZeY/DaSleomwRGGsc5pAiOldcVMEBH8e6FhPymxVqNyICXIkSCiS5T/5zGtC25FCi/uCnyf+PMZyQWucoM6Hs4RI63A5TFaQFA4qCnVx2N6RTg9ETIqGaMRQSv+Sc4mT0+mXtGi1u9+QHT2poUPP1SsYBCx00GbjKYYRt9KfbZgpQs5h5exsPIGPAlBwhibF0R4PWZ/WwIWJ2cB/83nUPSz8VK0rWjb0ZW0dWO8n6dQIVNTQoQW3j4sl8pM2HxI1hw== zooz@personal