Skip to content

Instantly share code, notes, and snippets.

View entrptaher's full-sized avatar
🎯
Focusing

Md. Abu Taher entrptaher

🎯
Focusing
View GitHub Profile
@entrptaher
entrptaher / Vagrantfile
Created May 6, 2023 16:11 — forked from markuskont/Vagrantfile
Set up basic cuda/tensorflow/gpuR env with vagrant-libvirt and vfio pci-passthrough
# -*- mode: ruby -*-
# vi: set ft=ruby :
LIBVIRT_POOL = 'fast'
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu1604"
config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: false
#config.vm.synced_folder "../../datastore/spindle/ML/datasets/", "/mnt", type: "nfs", nfs_udp: false
config.vm.network "private_network", :dev => "br0", :mode => 'bridge', :ip => "192.168.17.25"
@entrptaher
entrptaher / until.js
Created November 21, 2022 15:28 — forked from sscovil/until.js
A simple utility for Node.js to wait until a predicate function returns truthy before moving on; for use with ES6 async/await syntax.
/**
* Utility that waits for @predicate function to return truthy, testing at @interval until @timeout is reached.
*
* Example: await until(() => spy.called);
*
* @param {Function} predicate
* @param {Number} interval
* @param {Number} timeout
*
* @return {Promise}
@entrptaher
entrptaher / changetheme.sh
Created September 27, 2022 05:14 — forked from GuillaumeDesforges/changetheme.sh
Bash one liner to set Zsh theme with oh-my-zsh default setup
# Just change the first THEME variable to whatever theme you want. The line will edit, reload and print you the changed line in the .zshrc file
THEME="agnoster"; sed -i s/^ZSH_THEME=".\+"$/ZSH_THEME=\"$THEME\"/g ~/.zshrc && source ~/.zshrc && echo "Edited line in ~/zshrc :" && cat ~/.zshrc | grep -m 1 ZSH_THEME
@entrptaher
entrptaher / syncrc.sh
Created September 18, 2022 00:29
Sync your .files to OneDrive or other cloud storage.
#!/bin/bash
onedrive=`dirname $0`
zsh_dir=.oh-my-zsh #you may need modify this line
readonly onedrive
readonly zsh_dir
upload_ssh() {
od_ssh=$onedrive/.ssh
@entrptaher
entrptaher / install.sh
Created March 4, 2020 05:58 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@entrptaher
entrptaher / install-php-tools.sh
Last active August 3, 2022 02:15 — forked from agarzon/install-php-tools.sh
Install globally popular PHP dev tools like composer, phpunit, phpcs, phpmd, phpcpd, deployer, robo, codeception, etc.
#!/bin/bash
#To execute it directly: bash <(curl -s https://gist.githubusercontent.com/agarzon/ecb0b92d4c8e1bbde126534c76721a58/raw/install-php-tools.sh)
# bash <(curl -s https://gist.githubusercontent.com/entrptaher/5cbb8cac9b0a6366eda5f1b3a1c2790e/raw/027c108dfb192303c8aabaaabd7a3ea55f4ba6aa/install-php-tools.sh)
BIN_PATH=/home/someone/lampstack-7.1.13-1/php/bin/
#COMPOSER
curl -LsS https://getcomposer.org/composer.phar -o ${BIN_PATH}composer
chmod a+x ${BIN_PATH}composer
function sumNaive (n, acc = 0) {
if (n === 0) {
return acc
}
return sumNaive(n - 1, acc + n)
}
// console.log(sumNaive(1000))
// console.log(sumNaive(100000))
@entrptaher
entrptaher / array_splice.js
Last active July 17, 2017 06:08 — forked from arsho/array_splice.js
Array splice implementation to convert an existing array to target array
(() => {
/**
* Fill gaps of an array
* @param {Object} sourceArray - The source array to compare to
* @param {Object} targetArray - The target array to fill the gap
* @param {string} Filler - The element to be used to fill the gap
*/
let similarFill = ((sourceArray, targetArray, filler) => {
let pos = 0;
for (let i = 0; i < targetArray.length; i++) {