Skip to content

Instantly share code, notes, and snippets.

View arehmandev's full-sized avatar
🎯
Focusing

Abdul Rehman arehmandev

🎯
Focusing
  • Capgemini
  • London, UK
View GitHub Profile
@arehmandev
arehmandev / Dockerfile
Created July 1, 2019 21:16
Quick docker in docker
FROM debian:stretch-slim
RUN apt-get update -y && apt install -y curl && \
curl -LO https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/containerd.io_1.2.6-3_amd64.deb && apt install -f -y ./containerd.io_1.2.6-3_amd64.deb && \
curl -LO https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/docker-ce-cli_18.09.7~3-0~debian-stretch_amd64.deb && apt install -f -y ./docker-ce-cli_18.09.7~3-0~debian-stretch_amd64.deb && \
curl -LO https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/docker-ce_18.09.7~3-0~debian-stretch_amd64.deb && apt install -f -y ./docker-ce_18.09.7~3-0~debian-stretch_amd64.deb && \
rm -rf *.deb
@arehmandev
arehmandev / gist:2c705ad22c1d16844b72ba9f5e579778
Created January 30, 2019 05:02
Jenkins pipeline fail at ssh-add
Hi if you're seeing this - you probably got stuck where I was:
The pipeline randomly fails at ssh-add?
Guess what the fix is - add a new line at the end of your ssh key stored in jenkins, absolutely stupid right.
Here's an example of pipeline:
def tagBuild(gitTag){
// Required for setup of jenkins slave ssh daemon
tryAddKnownHost('github.com')
@arehmandev
arehmandev / CheckSubnetisPublic.sh
Last active August 18, 2019 13:53
Check if aws subnet is public - checks if internet gateway is attached to a route on a routetable of a subnet.
#!/usr/bin/env python3
# Quick script to create a dict of subnetid -> isPublic (check if AWS VPC subnet is public or not)
import boto3
ec2 = boto3.client('ec2')
subnetDict = {}
apicall = ec2.describe_route_tables()
@arehmandev
arehmandev / dynamicarray.go
Created June 22, 2018 23:32
Solution to hackerrank dynamic array
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
)
type Func func(key string) (interface{}, error)
type result struct {
value interface{}
err error
}
type entry struct {
res result
ready chan struct{}
@arehmandev
arehmandev / structs_interface.go
Created May 24, 2018 02:40 — forked from josephspurrier/structs_interface.go
Golang - Understand Structs and Interfaces
// Also available at: https://play.golang.org/p/yTTpB5gB6C
package main
import (
"fmt"
)
// *****************************************************************************
// Example 1 - Struct vs Struct with Embedded Type
@arehmandev
arehmandev / generate.sh
Created May 10, 2018 11:39
Running Helm and Tillerwith ssl on minikube
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
echo "Cleaning workspace"
ls -1 | grep -v generate.sh | xargs rm -rf
echo "Generating CA"
openssl genrsa -out ./ca.key.pem 4096
openssl req -key ca.key.pem -new -x509 -days 7300 -sha256 -out ca.cert.pem
class Example {
String name;
int ID;
static void main(String[] args) {
Example man = new Example()
man.getStudent()
println(man.name + " is " + man.ID)
@arehmandev
arehmandev / removeSliceElement.go
Created April 25, 2018 13:32
Iteratively remove elements from slice
package main
import "fmt"
func main() {
slice := []string{"TEST1", "TEST2", "TEST3", "TEST4"}
fmt.Println("SLICE AT START", slice)
for i := len(slice) - 1; i >= 0; i-- {
{
"$schema": "vscode://schemas/color-theme",
"comment": "Cold Snack, created by Evan Rowe.",
"author": "Evan Rowe",
"name": "Cold Snack Theme",
"tokenColors": [{
"settings": {
"background": "#002B36",
"foreground": "#93A1A1"
}