Skip to content

Instantly share code, notes, and snippets.

Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@gauravve
gauravve / upload-github-release-asset.sh
Created March 12, 2019 12:51 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
@gauravve
gauravve / redis-idle-clean.lua
Created January 26, 2019 06:14 — forked from TonyStarkBy/redis-idle-clean.lua
redis: delete keys by idle time
-- how to use:
-- redis-cli EVAL "$(cat redis-idle-clean.lua)" 2 key_name 86400
local keyTemplate = KEYS[1]
local keyMinIdleTime = tonumber(KEYS[2])
local function getUsedMemory()
local info = redis.call('info')
@gauravve
gauravve / launch.config
Last active September 7, 2018 21:35
VScode configuration serverless debug
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Serverless Offline",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"runtimeArgs": [
@gauravve
gauravve / package.json
Created September 7, 2018 13:19
Serverless debug
"scripts": {
"start": "./node_modules/.bin/serverless offline start -s dev",
"debug": "export SLS_DEBUG=* && node --inspect ./node_modules/.bin/serverless offline start",
},
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# Forked by rjorgenson - http://github.com/rjorgenson
#
# # README
#
# In order for this theme to render correctly, you will need a
swagger: "2.0"
host:
basePath: /v2
info:
version:
title:
license:
name:
contact:
@gauravve
gauravve / handler.js
Last active January 3, 2018 08:22
POST Authoriser
const contacts_post = (event, context, callback) => {
console.log('event', event);
// Write scope as its a POST
const requested_scope = ['write:contacts'];
//No token check
if (!event.authorizationToken) {
return callback('Unauthorized')
};
GLOBAL_ENV_VARS=$(cat ${WORKSPACE}/conf/aws.${AWS_CONF} | grep =)
#Remove any comments from GLOBAL_ENV_VARS
GLOBAL_ENV_VARS=$(echo "$GLOBAL_ENV_VARS" | sed 's/#.*//g')
#To override any values in GLOBAL_ENV_VARS
GLOBAL_ENV_VARS=$(echo "$GLOBAL_ENV_VARS" | sed "s/key_name=.*/key_name=${NONPROD_KEY_NAME}/g")
ansible-playbook -vvv ansible/axway_cf.yml --extra-vars "
$GLOBAL_ENV_VARS
#!/usr/bin/env python
# This is a trick, to output the bash commands we need to run in shell, and just execute this script inside an eval within our shell, so it imports what we need
# Possibly tie this in with https://gist.github.com/mbainter/b38a4cb411c0b5c1bae6 for MFA support
# Will need to durably store MFA access tokens, possibly in some other env vars
# Could also store all different keys/info in different vars, to reuse as needed (lots of env vars though, file may be better)
import os
import sys
import getpass