Skip to content

Instantly share code, notes, and snippets.

View subhajeet2107's full-sized avatar

Subhajeet Dey subhajeet2107

  • India
View GitHub Profile
@subhajeet2107
subhajeet2107 / gist:369bea339277e14e861e978e68d88ccc
Last active October 11, 2018 09:25
Nginx Pagespeed Settings and compilation
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --wit
@subhajeet2107
subhajeet2107 / Vagrantfile
Created October 8, 2018 15:10
vagrant file with docker installed for Rancher
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@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
@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 / 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 / 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 / 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 / check_file_size.sh
Created November 22, 2016 07:17
Check folder space on ubuntu
du -hsx * | sort -rh | head -10
@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 / 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]