Skip to content

Instantly share code, notes, and snippets.

View Tamal's full-sized avatar

Tamal Mukherjee Tamal

  • Tamal
  • /dev/null
View GitHub Profile
@Tamal
Tamal / minikube-upgrade.sh
Last active June 24, 2023 14:37
minikube upgrade
#! /bin/sh
# Minikube update script file
# For Macs use /latest/minikube-darwin-arm64
minikube delete && \
sudo rm -rf /usr/local/bin/minikube && \
sudo curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && \
sudo chmod +x minikube && \
sudo cp minikube /usr/local/bin/ && \
@Tamal
Tamal / set-chroot.sh
Last active April 26, 2024 09:57
Setting up chroot from a live image in Fedora. Regenerate grub2 for Fedora.
$ # Use Live CD to boot
$ sudo su # Switch to root
$ fdisk -l # Get names of root, boot & EFI partition names. you can also use blkid
$ mount /dev/mapper/fedora_localhost--live-root /mnt # mount root partition
$ cat /mnt/etc/fedora-release
Fedora release 31 (Thirty One)
$ mount /dev/nvme0n1p2 /mnt/boot # mount boot partition
$ mount /dev/nvme0n1p1 /mnt/boot/efi # mount EFI partition
# Note: If you are not able to mount EFI partition ('Input/Output error'),
# You may have to repair ESP file system or format ESP.
@Tamal
Tamal / aws-multipartUpload.js
Created December 23, 2018 09:23 — forked from sevastos/aws-multipartUpload.js
Example AWS S3 Multipart Upload with aws-sdk for Node.js - Retries to upload failing parts
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws-config.json');
var s3 = new AWS.S3();
// File
var fileName = '5.pdf';
var filePath = './' + fileName;
var fileKey = fileName;
@Tamal
Tamal / git-ssh-error-fix.sh
Last active May 8, 2024 15:47
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
import {action1, action2} from "myActions";
import {bindActionCreators} from "redux";
const mapDispatchToProps(dispatch) => {
return {
manuallyBoundAction : (...args) => dispatch(action1(...args)),
autoBoundAction : bindActionCreators(action2, dispatch),
multipleActionsTogether : bindActionCreators({action1, action2}, dispatch)
}
};
@Tamal
Tamal / app.js
Created July 28, 2018 11:44 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@Tamal
Tamal / install_tensorflow_on_fedora.md
Last active July 19, 2018 14:02
Install TensorFlow on Fedora

Install cuda and nvdia driver

sudo dnf config-manager --add-repo=http://negativo17.org/repos/fedora-nvidia.repo
sudo dnf install cuda-devel cuda-cudnn-devel
sudo dnf install nvidia-settings kernel-devel dkms-nvidia vulkan nvidia-driver-libs nvidia-driver-cuda

Install tensorflow gpu

pip install tensorflow-gpu
@Tamal
Tamal / async-await.js
Created April 25, 2018 08:59 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@Tamal
Tamal / install-comodo-ssl-cert-for-nginx.rst
Created January 2, 2018 14:31 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert