Skip to content

Instantly share code, notes, and snippets.

@mujahidk
mujahidk / git-find-big-files-in-hist.sh
Created July 2, 2021 13:34 — forked from masbicudo/git-find-big-files-in-hist.sh
Script to find large files in git history
#!/bin/bash
# This code is based on the awesome answer by @torek from StackOverflow:
# https://stackoverflow.com/a/41626019/195417
# I have only made a shell for his code, added some options, added some colors
# and voilà!
#
# This script can be used to find large files inside a git repository
# and it's whole history. It will list files larger than a given threshold,
# and display these files in a colored human readable way.
#
@mujahidk
mujahidk / .vimrc
Last active May 27, 2020 13:51
VIM configuration
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'git://git.wincent.com/command-t.git'
@mujahidk
mujahidk / vim-search-replace-lines.vim
Created April 24, 2020 20:21
Vim - add comment (#) to certain lines
:3,10s/^/\#/g
@mujahidk
mujahidk / pdfbox-hello-world.groovy
Created April 21, 2020 03:06
PDFBox - Hello, World PDF Sample
// Original source: https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/HelloWorld.java?view=markup
// LICENSE: http://www.apache.org/licenses/LICENSE-2.0
@Grapes(
@Grab(group='org.apache.pdfbox', module='pdfbox', version='2.0.19')
)
import org.apache.pdfbox.pdmodel.PDDocument
import org.apache.pdfbox.pdmodel.PDPage
import org.apache.pdfbox.pdmodel.PDPageContentStream
@mujahidk
mujahidk / aws-codedeploy-apps-list.groovy
Last active March 18, 2020 18:32
AWS SDK - List CodeDeploy applications
@Grapes(
[
@Grab(group='software.amazon.awssdk', module='bom', version='2.10.86', type='pom'),
@Grab(group='software.amazon.awssdk', module='codedeploy', version='2.10.86'),
@Grab(group='ch.qos.logback', module='logback-classic', version='1.2.3')
]
)
import software.amazon.awssdk.services.codedeploy.*
import software.amazon.awssdk.regions.*
@mujahidk
mujahidk / postgresql.py
Created February 3, 2020 21:42
Python connection to PostgreSQL and Pandas
# Shell
# pip --version
# pip install psycopg2-binary
import psycopg2 as pg
import pandas as pd
connection = pg.connect("host='host-name-here' dbname=DBNAME user='username' password='password'")
df = pd.read_sql_query("SELECT * FROM product", connection)
@mujahidk
mujahidk / extract-mvn-dependencies.groovy
Last active January 22, 2020 17:46
Extract Maven dependencies into an html table structure (a hack!)
// mvn dependency:list | egrep -i 'mujahidk'
def output = "mvn dependency:list | egrep -i 'mujahidk'".execute().text
print '%html '
println '<table>'
output.split("\r\n").each { line ->
def result = line ==~ /\[INFO\]\s+(([\w\-\.])*:){3,6}.*/
@mujahidk
mujahidk / debian-enable-disable-sleep.md
Last active February 23, 2024 01:24
Debian enable/disable sleep

Debian enable/disable sleep

From: https://wiki.debian.org/Suspend

To Disable Sleep

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

To Enable

@mujahidk
mujahidk / markdown-to-html-txtmark.groovy
Created November 18, 2019 15:09
Java Markdown to html using txtmark
@Grapes(
[
@Grab(group='com.github.rjeschke', module='txtmark', version='0.13')
]
)
import com.github.rjeschke.txtmark.*
def markdown = '''
# Heading 1
@mujahidk
mujahidk / oracle-row-numbers.sql
Created April 17, 2019 16:33
Oracle generate rows of serial numbers
SELECT
level
FROM
dual
CONNECT BY 1 = 1 AND level <= 20;