Skip to content

Instantly share code, notes, and snippets.

@rkalkani
rkalkani / gitlab-backup.md
Created February 15, 2023 11:29 — forked from nikvdp/gitlab-backup.md
Back up GitLab to GitHub

Backup your GitLab repos to GitHub

GitLab recently decided to silently delete any repositories that hadn't been accessed in the last year. The announcement didn't go over well and they soon caved to public pressure and decided to instead back up inactive repos to object storage instead of unilaterally deleting them. I'm glad they reconsidered, but the experience left me with a bad taste in my mouth, so I decided to look into (relatively) low

@rkalkani
rkalkani / app.js
Created August 27, 2021 12:19 — forked from moso/app.js
laravel-mix config
// jQuery import
global.jQuery = require('jquery');
var $ = global.jQuery;
window.$ = $;
// Bootstrap 4 depends on Popper.js
// Popper.js import
//import Popper from 'popper.js';
//window.Popper = Popper;
@rkalkani
rkalkani / get-public-ip.md
Created June 28, 2020 08:43
Get public IP address used by your machine to connect to the internet

Get Public IP

DNS

Google

dig o-o.myaddr.l.google.com txt @ns1.google.com +short
# OR
nslookup -type=txt o-o.myaddr.l.google.com ns1.google.com
@rkalkani
rkalkani / backup-restore-mongodb-database.txt
Created June 27, 2020 10:51
Snippets to backup/restore mongodb database from docker container
# Backup mongodb from docker container
docker exec -i ${CONTAINER_NAME} mongodump --uri=${DB_URI} --archive --gzip > $(date +%Y%m%d_%H%M%S)_${DB_NAME}.pgsql.gz
# Restore mongodb from docker container
cat ${FILENAME}.mongodump.gz | docker exec -i ${CONTAINER_NAME} mongorestore --uri=${DB_URI} --nsFrom="${SRC_DB}.*" --nsTo="${DB}.*" --archive --gzip
@rkalkani
rkalkani / backup-restore-postgresql-database.txt
Last active June 27, 2020 10:50
Snippets to backup/restore postgresql database from docker container
# Backup postgresql db from postgresql docker container
docker exec -i ${CONTAINER_NAME} pg_dump -U ${USERNAME} -w ${DB_NAME} -O -x | gzip -9 > $(date +%Y%m%d_%H%M%S)_${DB_NAME}.pgsql.gz
# Restore the postgresql db to postgresql docker container
gunzip -c ${FILENAME}.pgsql.gz | sudo docker exec -i ${CONTAINER_NAME} pg_restore -U ${USERNAME} -w -d ${DB_NAME} -C --clean -Fc -O -x
@rkalkani
rkalkani / fix-author.sh
Created June 4, 2020 08:57
Bulk git author email correction
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
Enable systemd-networkd debugging
mkdir -p /etc/systemd/system/systemd-networkd.service.d/
Create Drop-In /etc/systemd/system/systemd-networkd.service.d/10-debug.conf with following content:
[Service]
Environment=SYSTEMD_LOG_LEVEL=debug
And restart systemd-networkd service:
systemctl daemon-reload
#!/bin/sh
sudo apt-get update
sudo apt-get -y install build-essential cmake git pkg-config python-dev
sudo apt-get -y install libjpeg-dev libtiff5-dev libjpeg8-dev libjasper-dev libpng12-dev
sudo apt-get -y install libgtk2.0-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get -y install libatlas-base-dev gfortran libxvidcore-dev libx264-dev
sudo pip install numpy
git clone https://github.com/opencv/opencv
@rkalkani
rkalkani / php-mongodb.sh
Last active September 5, 2017 05:26
Install php mongodb driver for mongodb 3.4
# Ubuntu 16.04
sudo apt-get install libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev
# Install php dev
sudo apt-get install php-dev
# for php5.6, sudo apt-get install php5.6-dev
# Install pecl
sudo apt-get install php-pear
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl