Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Abdul Rehman arehmandev

🎯
Focusing
  • Capgemini
  • London, UK
Block or report user

Report or block arehmandev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.go
package main
import "fmt"
func main() {
intslice := [][]int{[]int{1}, []int{2}}
// Grow
for index, value := range intslice {
@arehmandev
arehmandev / openvpn_gen.py
Created Oct 21, 2019 — forked from Justasic/openvpn_gen.py
This is a python script to generate client OpenVPN configuration files. This is based mostly on the easyrsa script and is much simpler to understand.
View openvpn_gen.py
import os
import socket
from OpenSSL import crypto, SSL
# OpenVPN is fairly simple since it works on OpenSSL. The OpenVPN server contains
# a root certificate authority that can sign sub-certificates. The certificates
# have very little or no information on who they belong to besides a filename
# and any required information. Everything else is omitted or blank.
# The client certificate and private key are inserted into the .ovpn file
# which contains some settins as well and the entire thing is then ready for
@arehmandev
arehmandev / nginx.conf
Created Oct 14, 2019
Nginx transparent proxy
View nginx.conf
events {
worker_connections 1024;
}
http {
# google's DNS server
resolver 8.8.8.8;
resolver_timeout 5s;
server {
# proxy server port
View manage-openvpn-nopass.sh
#!/bin/bash
#
# Copyright (c) 2013 Nyr. Released under the MIT License.
# Copyright (c) 2019 Fabrice Triboix
set -eu
###################
# Parse arguments #
@arehmandev
arehmandev / .zshrc
Last active Aug 19, 2019
terraform aliases
View .zshrc
function tfinit () {
if [ -z "${1}" ]; then
terraform init
else
terraform init -backend-config=${1}
fi
}
function tfplan () {
if [ -z "${1}" ]; then
@arehmandev
arehmandev / Dockerfile
Created Jul 1, 2019
Quick docker in docker
View Dockerfile
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
View gist:2c705ad22c1d16844b72ba9f5e579778
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 Aug 18, 2019
Check if aws subnet is public - checks if internet gateway is attached to a route on a routetable of a subnet.
View CheckSubnetisPublic.sh
#!/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 Jun 22, 2018
Solution to hackerrank dynamic array
View dynamicarray.go
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
)
View cache.go
type Func func(key string) (interface{}, error)
type result struct {
value interface{}
err error
}
type entry struct {
res result
ready chan struct{}
You can’t perform that action at this time.