Skip to content

Instantly share code, notes, and snippets.

@mpls
mpls / install_neovim_to_amazonlinux.sh
Created January 14, 2021 13:39 — forked from kawaz/install_neovim_to_amazonlinux.sh
install neovim to amazonlinux
#!/usr/bin/env bash
sudo yum groups install -y Development\ tools
sudo yum install -y cmake
sudo yum install -y python34-{devel,pip}
sudo pip-3.4 install neovim --upgrade
(
cd "$(mktemp -d)"
git clone https://github.com/neovim/neovim.git
cd neovim
make CMAKE_BUILD_TYPE=Release
@mpls
mpls / .git-commit-template.txt
Created August 21, 2020 14:31 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@mpls
mpls / README.md
Created October 21, 2018 13:47
QEMU + Ubuntu ARM aarch64

QEMU + Ubuntu ARM aarch64

These are the steps I used to get Ubuntu ARM aarch64 running with QEMU on OSX.

Get Ubuntu Image and QEMU EFI:

wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-arm64-uefi1.img
wget https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/QEMU_EFI.fd
@mpls
mpls / kerberos_setup.md
Created September 4, 2018 06:11 — forked from ashrithr/kerberos_setup.md
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • Kerberos Client: kclient.cw.com

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

An Ansible summary

Patterns

  • all (or *)
  • hostname: foo.example.com
  • groupname: webservers
  • or: webservers:dbserver
  • exclude: webserver:!phoenix
  • intersection: webservers:&amp;staging
/*
The code below shows how to encrypt and then decrypt some plaintext into a cyphertext using
KMS's Encrypt/Decrypt functions and secretbox (https://godoc.org/golang.org/x/crypto/nacl/secretbox).
The plaintext message is sealed into a secretbox using a key that is generated by kmsClient.GenerateDataKey().
Note that this procedure reuquires that a master key would *already exist in KMS* and that its arn/alias is specified.
The aws library assumes that the proper credentials can be found in the shared file (~/.aws/credentials)
and opts for the 'default' role.
Once sealed, the cyphertext is then unboxed, again by first getting the key from kms (kmsClient.Decrypt),
@mpls
mpls / mysql.py
Created May 16, 2018 05:12 — forked from abg/mysql.py
Run queries directly against MySQL via subprocess, rather than using MySQLdb
"""Examples fetching data from MySQL via /usr/bin/mysql"""
import subprocess
def get_innodb_log_file_size():
"""Run SELECT @@innodb_log_file_size and return the value as an integer"""
process = subprocess.Popen(['mysql', '-ss'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
@mpls
mpls / stdout-stderr-rtncode-in-bash.sh
Created April 19, 2018 05:55 — forked from jmmitchell/stdout-stderr-rtncode-in-bash.sh
capture standard out, standard error and return code in bash
# #!/bin/bash
#
# based on posts from stackexchange:
# http://stackoverflow.com/a/26827443/171475
# http://stackoverflow.com/a/18086548/171475
# http://stackoverflow.com/a/28796214/171475
function example_function {
printf 'example output to stdout %d\n' {1..10}
echo >&2 'example output to stderr'
@mpls
mpls / janus.plugin.streaming.cfg
Created April 18, 2018 16:02 — forked from cfobel/janus.plugin.streaming.cfg
WebRTC Stream Logitech C920 through Janus gateway
; /opt/janus/etc/janus/janus.plugin.streaming.cfg
; [stream-name]
; type = rtp|live|ondemand|rtsp
; rtp = stream originated by an external tool (e.g., gstreamer or
; ffmpeg) and sent to the plugin via RTP
; live = local file streamed live to multiple listeners
; (multiple listeners = same streaming context)
; ondemand = local file streamed on-demand to a single listener
; (multiple listeners = different streaming contexts)
; rtsp = stream originated by an external RTSP feed (only
@mpls
mpls / isexist_vs_isnotexist.go
Created August 8, 2017 07:13 — forked from mastef/isexist_vs_isnotexist.go
os.IsExist(err) vs os.IsNotExist(err)
/*
Watch out, os.IsExist(err) != !os.IsNotExist(err)
They are error checkers, so use them only when err != nil, and you want to handle
specific errors in a different way!
Their main purpose is to wrap around OS error messages for you, so you don't have to test
for Windows/Unix/Mobile/other OS error messages for "file exists/directory exists" and
"file does not exist/directory does not exist"