Skip to content

Instantly share code, notes, and snippets.

# 1. redo last command but as root
sudo !!
# 2. open an editor to run a command
ctrl+x+e
# 3. create a super fast ram disk
mkdir -p /mnt/ram
mount -t tmpfs tmpfs /mnt/ram -o size=8192M
@nkhine
nkhine / make go executible
Last active April 27, 2019 20:05
if we want to use go like python and executed without gorun
```
echo ':golang:E::go::/usr/local/bin/gorun:OC' | sudo tee /proc/sys/fs/binfmt_misc/register
:golang:E::go::/usr/local/bin/gorun:OC
```
```
package main
import (
"fmt"
@nkhine
nkhine / gist:0b7f5c162313946ddd2f8d7feb57144a
Created January 28, 2019 17:12
ruby-build -v 1.8.7 /usr/local
bash-4.4# ruby-build -v 1.8.7 /usr/local
Downloading ruby-1.8.7.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.bz2
/tmp/ruby-build.20190128170412.7047 /tmp/ruby-build
Installing ruby-1.8.7...
WARNING: ruby-1.8.7 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
/tmp/ruby-build.20190128170412.7047/ruby-1.8.7 /tmp/ruby-build.20190128170412.7047 /tmp/ruby-build
@nkhine
nkhine / kubectl.md
Last active July 16, 2019 15:21 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyexcel as p
>>> dict_list=[{'alfa':['001','2'], 'beta':['001','3'], 'gamma':['001','2']},
... {'alfa':['002','6'], 'beta':['002','4'], 'omega':['002','7']}]
>>>
>>> s = p.Sheet()
>>> for d in dict_list:
... s.row += p.get_sheet(adict=d, transpose_after=True)
MySQL wizardry
Posted on June 5, 2001
by Giuseppe_Maxia
“I called in the Wizard on a Friday evening. It was almost six p.m. and I was afraid he had already left for the day. Instead, he answered at the first ring. Wizards never go home early. He recognized me and asked how he could help. I told him. He listed patiently, without asking silly questions in between, and finally said ‘I think I could provide you with some useful tool. See you in half an hour’ and hung up.”
Cross tabulations are statistical reports where you de-normalize your data and show results grouped by one field, having one column for each distinct value of a second field.
Basic problem definition. Starting from a list of values, we want to group them by field A and create a column for each distinct value of field B.
@nkhine
nkhine / jenkins-api.md
Created July 18, 2018 14:50 — forked from justlaputa/jenkins-api.md
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

@nkhine
nkhine / gist:d76a1759c24a46af20745958ea4afa32
Last active March 6, 2018 10:52 — forked from moneytoo/gist:ab3f34e4fddc2110675952f8280f49c5
nginx with OpenSSL 1.0.2 (ALPN) on CentOS 7, also available from https://brouken.com/brouken-centos-7-repo/
### No longer needed as of nginx-1.13.9-1.el7_4.ngx.x86_64.rpm from nginx.org
### it was compiled against OpenSSL 1.0.2 from CentoOS 7.4 so it supports ALPN (HTTP2 works)
### nginx-module-njs-1.13.9.0.1.15-1.el7_4.ngx.x86_64.rpm
yum -y groupinstall 'Development Tools'
yum -y install wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel rpmdevtools
OPENSSL="openssl-1.0.2l"
NGINX_VERSION="1.13.9-1"
NJS_VERSION="1.13.9.0.1.15-1"
@nkhine
nkhine / cognito.yaml
Created August 24, 2017 05:04 — forked from singledigit/cognito.yaml
Create a Cognito Authentication Backend via CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages