Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
Behold! The unquenchable fire of the stars!

Akshay Mankar akshaymankar

🔥
Behold! The unquenchable fire of the stars!
View GitHub Profile
@akshaymankar
akshaymankar / gen-hie-yaml.sh
Last active Mar 21, 2020
Generate hie.yaml for a stack project
View gen-hie-yaml.sh
#!/usr/bin/env bash
# requirements: yq, awk, stack
set -euo pipefail
echo "cradle:"
echo " stack:"
for pkg in `stack ide targets --stdout`; do
dir=$(echo $pkg | awk -F: '{print $1}')
View TypedWatch.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module TypedWatch where
import Control.Exception.Safe
import Data.Aeson
import Data.Function ((&))
import Data.Text (Text)
import Kubernetes.Client.Watch
import Kubernetes.OpenAPI
@akshaymankar
akshaymankar / tmux-score.sh
Created Jun 5, 2019
World Cup tmux score
View tmux-score.sh
curl -s https://cricketapi-icc.pulselive.com/fixtures/8199/scoring | jq -r '(["SA: ", .innings[0].scorecard.runs, "/", .innings[0].scorecard.wkts, " (", .innings[0].overProgress, ") - ", "IND: ", .innings[1].scorecard.runs, "/", .innings[1].scorecard.wkts, " (", .innings[1].overProgress, ")"] | join(""))'
View privileged-daemonset.yaml
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: privileged-ds
spec:
selector:
matchLabels:
app: privileged
template:
metadata:
@akshaymankar
akshaymankar / merge-repo.sh
Created Aug 15, 2018
Merge two repositories
View merge-repo.sh
git checkout git@github.com:akshaymankar/repo-1
cd repo-1
git remote add repo-2 git@github.com:akshaymankar/repo-2
git fetch repo-2
git merge repo-2/master --allow-unrelated-histories
git push origin master
@akshaymankar
akshaymankar / alias-kubectl-on-master.sh
Last active Aug 15, 2018
Alias kubectl from master deployed by CFCR
View alias-kubectl-on-master.sh
token=$(cat /var/vcap/jobs/kube-apiserver/config/tokens.csv | grep admin | awk -F, '{print $1}' | xargs echo)
alias kubectl="/var/vcap/packages/kubernetes/bin/kubectl -s https://master.cfcr.internal:8443 --token $token --insecure-skip-tls-verify=true"
@akshaymankar
akshaymankar / sneakyPrint.hs
Created Oct 15, 2017
Print sneakily in haskell, strictly to be used for debugging
View sneakyPrint.hs
sneakyPrint :: Show a => a -> a
sneakyPrint a = unsafePerformIO $ do
print a
return a
@akshaymankar
akshaymankar / flyjack.sh
Last active Aug 10, 2017
HIjack a concourse container by URL
View flyjack.sh
#!/bin/bash
set -eu
print_usage() {
echo "Usage: $(basename "$0") <job-url>"
}
invalid_job_url() {
echo "Argument [\"$1\"] isn't a valid job url."
View lxc-centos
#!/bin/bash
#
# template script for generating CentOS container for LXC
#
#
# lxc: linux Container library
# Authors:
@akshaymankar
akshaymankar / httpd.rb
Created Aug 5, 2013
Simple http server in ruby. Because you can't install gems everywhere !
View httpd.rb
require 'socket'
server = TCPServer.open 9000
puts "Listening on port 9000"
loop {
client = server.accept()
while((x = client.gets) != "\r\n")
puts x
end