Skip to content

Instantly share code, notes, and snippets.

View subhajeet2107's full-sized avatar

Subhajeet Dey subhajeet2107

  • India
View GitHub Profile
@subhajeet2107
subhajeet2107 / compress_dump.sh
Created July 30, 2016 08:41
Command to Compress a MySQL dump at highest compression level
tar cv path_to_dump.sql | xz -9 > filename.tar.xz
@subhajeet2107
subhajeet2107 / mysql_backup.sh
Created August 5, 2016 11:11
Simple bash script to take mysql backup of database
#!/bin/bash
# Simple script to backup MySQL databases
# Parent backup directory
backup_parent_dir="/var/dbdumps/mysql"
# MySQL settings
mysql_user="root"
mysql_password=""
#name of database which you want to backup
@subhajeet2107
subhajeet2107 / django_python_interview_questions.md
Last active May 30, 2024 06:44
Simple Interview questions for Django Developer

Django/Python Questions

  1. Find the most frequent integer in a list, Test list : [3,5,6,3,9,0,3,8,3,1,3]

  2. Find the common elements of 2 lists

        a = [2,3,4,1,1,3,6]
        b = [2,8,9,1,3]
@subhajeet2107
subhajeet2107 / mysql_remote_connect.sh
Created October 3, 2016 07:03
Connect to remote mysql instance through localhost tunnel
#for windows install putty and plink and try this
plink.exe -L 3307:mysqlhost-or-localhost:3306 username@serverip -i keyfile.ppk
#for mac
ssh -L 3307:mysql-rds-host-or-localhost:3306 username@serverip -i keyfile.ppk
@subhajeet2107
subhajeet2107 / check_file_size.sh
Created November 22, 2016 07:17
Check folder space on ubuntu
du -hsx * | sort -rh | head -10
@subhajeet2107
subhajeet2107 / clonefix.js
Created July 24, 2017 18:36
selectize clone fix
$('.selectize').each(function(){
if ($(this)[0].selectize) {
var value = $(this).val(); // store the current value of the select/input
$(this)[0].selectize.destroy(); // destroys selectize()
$(this).val(value); // set back the value of the select/input
}
});
$('.add-role-row-container').append($('.add-role-row')[0].outerHTML);
$('.selectize').each(function(){
@subhajeet2107
subhajeet2107 / keybase.md
Created October 5, 2017 11:46
Keybase PGP

Keybase proof

I hereby claim:

  • I am subhajeet2107 on github.
  • I am subhajeet2107 (https://keybase.io/subhajeet2107) on keybase.
  • I have a public key ASBzIXapK0yfLGWNjhyA_IFGzE9_zVGIGiclEAxgd1NWtgo

To claim this, I am signing this object:

@subhajeet2107
subhajeet2107 / table_sizes.sql
Created April 10, 2018 06:58
Quickly Check the size of tables in MBs
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES WHERE information_schema.TABLES.table_schema = 'your_database_name'
ORDER BY (data_length + index_length) DESC;
@subhajeet2107
subhajeet2107 / ec.load
Last active April 29, 2018 17:17
mysql to postgres pgloader load file
load database
from mysql://root:password@localhost/database
into pgsql://postgres:root@localhost/database
WITH include drop, create tables, no truncate,
create indexes, reset sequences, foreign keys
CAST type datetime to timestamptz
drop default drop not null using zero-dates-to-null,
type date drop not null drop default using zero-dates-to-null
@subhajeet2107
subhajeet2107 / cleanup.sh
Created October 8, 2018 14:16
Cleanup Docker Containers with volume
#!/bin/sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
sudo rm -rf $dir
done