-
Find the most frequent integer in a list, Test list : [3,5,6,3,9,0,3,8,3,1,3]
-
Find the common elements of 2 lists
a = [2,3,4,1,1,3,6] b = [2,8,9,1,3]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar cv path_to_dump.sql | xz -9 > filename.tar.xz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -hsx * | sort -rh | head -10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.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(){ |
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
OlderNewer