Skip to content

Instantly share code, notes, and snippets.

View hayderimran7's full-sized avatar

Imran Hayder hayderimran7

View GitHub Profile
@hayderimran7
hayderimran7 / redirect.py
Created May 23, 2018 12:01 — forked from shreddd/redirect.py
Simple Redirect Server in python to redirect requests to a specified URL
#!/usr/bin/env python
"""
Simple HTTP URL redirector
Shreyas Cholia 10/01/2015
usage: redirect.py [-h] [--port PORT] [--ip IP] redirect_url
HTTP redirect server
positional arguments:

To test ldap, use ldapsearch util as:

ldapsearch -b "dc=example,dc=com" -H ldap://whatever.com -D "cn=System,ou=people,ou=hq,dc=example,dc=com" -w <PASSWORD> "(objectclass=*)"

this will list all users. To get specific user:

ldapsearch -b "dc=example,dc=com" -H ldap://whatever.com -D "cn=System,ou=people,ou=hq,dc=example,dc=com" -w <PASSWORD>  "(uid=HAHAHHA)"
@hayderimran7
hayderimran7 / gist:4002c92d20e561f7ecec16a20c96994d
Created October 25, 2017 18:39 — forked from jaimegago/gist:11229750
Grafana Dashboards Backups
#!/usr/bin/python -tt
#
import datetime
import json
import logging
import logging.handlers
import optparse
import os
import re
import shutil
@hayderimran7
hayderimran7 / reuse_agent.sh
Created October 12, 2017 22:31 — forked from MarkRose/reuse_agent.sh
Reuse existing ssh-agent or start a new one
# Reuse an existing ssh-agent on login, or create a new one. Append this to your .bashrc
# I have no idea who the author of the original concept was for reusing agents. This
# version also handles the case where the agent exists but has no keys.
GOT_AGENT=0
for FILE in $(find /tmp/ssh-* -type s -user ${LOGNAME} -name "agent.[0-9]*" 2>/dev/null)
do
SOCK_PID=${FILE##*.}
@hayderimran7
hayderimran7 / Jenkins+Script+Console.md
Created September 5, 2017 20:46 — forked from mubbashir/Jenkins+Script+Console.md
jenkins groovy scripts collection.

rebase vs. merge

Merging:

Is great for cross-branch scenarios--merging candidates into stable, stable into topics, etc.
In cross-branch scenarios, fast-forwarding generally isn't preferred as seeing a no-op merge commit into stable or into a new candidate is still useful for DAG aesthetics

Rebasing:

Is great for local commits to avoid same-branch merges (where a dev has a local, unshared commit and then creates a useless merge of it into the same branch that has since moved on)

@hayderimran7
hayderimran7 / masq.sh
Created June 9, 2017 22:30 — forked from mowings/masq.sh
script to get xet xhyve working with all vpn interfaces
#!/bin/bash
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) )
rulefile="rules.tmp"
echo "" > $rulefile
sudo pfctl -a com.apple/tun -F nat
for i in "${interfaces[@]}"
do
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}"
echo $RULE >> $rulefile
done

How to fix gradle Could not find tools.jar

while building a jenkins plugin , i saw this error on ubuntu:

./gradlew jpi
:localizer UP-TO-DATE
:stapler UP-TO-DATE
:compileJava FAILED

FAILURE: Build failed with an exception.
@hayderimran7
hayderimran7 / kruskal.py
Created February 21, 2017 07:17 — forked from msAzhar/kruskal.py
Kruskal's Algorithm (Python)
parent = dict()
rank = dict()
def make_set(vertice):
parent[vertice] = vertice
rank[vertice] = 0
def find(vertice):
if parent[vertice] != vertice:
parent[vertice] = find(parent[vertice])
@hayderimran7
hayderimran7 / jenkins_backup_script.md
Last active June 15, 2018 10:42
Jenkins backup using a job