Skip to content

Instantly share code, notes, and snippets.

View shabbirh's full-sized avatar
💭
is reflecting ...

Shabbir R Hassanally shabbirh

💭
is reflecting ...
View GitHub Profile
@shabbirh
shabbirh / gitlab-to-bitbucket.py
Created December 5, 2020 23:12 — forked from danhper/gitlab-to-bitbucket.py
Script to migrate repositories from GitLab to Bitbucket
import os
import re
import subprocess
import requests
GITLAB_ENDPOINT = os.environ["GITLAB_ENDPOINT"]
GITLAB_TOKEN = os.environ["GITLAB_TOKEN"]
@shabbirh
shabbirh / wsl2-network.ps1
Created September 14, 2020 08:11 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
public static class DateTimeExtensionMethods
{
public static int GetMonthsDiff(this DateTime fromDate, DateTime toDate)
{
if (fromDate > toDate)
{
var aux = fromDate;
fromDate = toDate;
toDate = aux;
}
@shabbirh
shabbirh / docker-daemon-make-tls-certs.sh
Last active October 27, 2019 15:11
Bash script to generate tls certificates for your docker installation. Self signed.
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage:"
echo "You must enter exactly 2 command line arguments"
echo "First the host for which you are generating the certificates"
echo "Second where you want to store the generated files - everything in that directory will be deleted"
echo "You should also give the FULLY QUALIFIED PATH for where you want to store the files - e.g. /etc/docker/ssl/certs/location"
echo "Relative paths will not work at this time"
echo ""
@shabbirh
shabbirh / toggle_swap.sh
Created July 3, 2019 21:12 — forked from Jekis/toggle_swap.sh
Empty swap. Clear swap. Move swap to RAM. Ubuntu.
#!/bin/bash
function echo_mem_stat () {
mem_total="$(free | grep 'Mem:' | awk '{print $2}')"
free_mem="$(free | grep 'Mem:' | awk '{print $7}')"
mem_percentage=$(($free_mem * 100 / $mem_total))
swap_total="$(free | grep 'Swap:' | awk '{print $2}')"
used_swap="$(free | grep 'Swap:' | awk '{print $3}')"
swap_percentage=$(($used_swap * 100 / $swap_total))
@shabbirh
shabbirh / gist:90d3351743f38efad1bea05a7d2746ae
Created November 21, 2018 17:12 — forked from thomseddon/gist:3511330
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
@shabbirh
shabbirh / wpwatcher.py
Created September 23, 2016 20:18 — forked from Neo23x0/wpwatcher.py
Wordpress Watcher - WPScan Vulnerabilty Scan on Wordpress Sites and Reporting
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# -*- coding: utf-8 -*-
#
# Wordpress Watcher
# Automating WPscan to scan and report vulnerable Wordpress sites
# Florian Roth
# v0.1
# March 2015
#
@shabbirh
shabbirh / OpenWithSublimeText3.bat
Created September 17, 2016 20:53 — forked from cstewart90/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 10)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@shabbirh
shabbirh / DynamicHelper.cs
Created April 8, 2016 13:26 — forked from martinnormark/DynamicHelper.cs
C# Dynamic extension methods for serializing to XML
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
/// <summary>
/// Extension methods for the dynamic object.
/// </summary>
@shabbirh
shabbirh / nginx-vhost.conf
Created October 11, 2015 17:26 — forked from tjstein/nginx-vhost.conf
nginx vhost config for WordPress + PHP-FPM
upstream php-fpm {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name www.example.com;
rewrite ^ http://example.com$request_uri?;
}