Skip to content

Instantly share code, notes, and snippets.

View spdin's full-sized avatar
🏠
Working from home

Saripudin spdin

🏠
Working from home
View GitHub Profile
# https://rtyley.github.io/bfg-repo-cleaner/
# check pack size
git count-objects -v -H
# download bfg and move to directory, rename to bfg
wget https://repo1.maven.org/maven2/com/madgag/bfg/1.13.0/bfg-1.13.0.jar
# clone mirror
git clone --mirror git://example.com/some-big-repo.git
@spdin
spdin / install_samba.sh
Created January 30, 2020 09:59
Install Samba on Ubuntu
#install samba
sudo apt install samba
#check installation
whereis samba
# output :
# samba: /usr/sbin/samba /usr/lib/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz /usr/share/man/man8/samba.8.gz
# edit file
sudo nano /etc/samba/smb.conf
@spdin
spdin / docker_horovod_collection.sh
Last active March 3, 2020 11:09
Docker and horovod command collection
# build images from Dockerfile
docker build -t horovod:latest horovod-docker-gpu
# get list images
docker images
# get list container
docker ps
# remove container
@spdin
spdin / Dockerfile
Created January 29, 2020 06:36
Dockerfile for horovod with PyTorch 1.3.0
# This Dockerfile specifically for using PyTorch 1.3.0
FROM nvidia/cuda:10.0-devel-ubuntu18.04
# TensorFlow version is tightly coupled to CUDA and cuDNN so it should be selected carefully
# ENV TENSORFLOW_VERSION=2.0.0
ENV PYTORCH_VERSION=1.3.0
ENV TORCHVISION_VERSION=0.4.1
ENV CUDNN_VERSION=7.6.0.64-1+cuda10.0
ENV NCCL_VERSION=2.4.7-1+cuda10.0
# ENV MXNET_VERSION=1.5.0
@spdin
spdin / install_nvidia_docker_ubuntu_16.04.sh
Created January 29, 2020 06:34
Install nvidia-docker on Ubuntu-16.04
# Install nvidia-container-toolkit
# source : https://github.com/NVIDIA/nvidia-docker#ubuntu-16041804-debian-jessiestretchbuster
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
# Install nvidia-runtime
# Download nvidia-runtime packages
@spdin
spdin / install_docker_ubuntu_16.04.sh
Last active January 29, 2020 06:30
Install Docker on Ubuntu-16.04
# add the GPG key for the official Docker repository to the system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add the Docker repository to APT sources
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# update the package database with the Docker packages from the newly added repo
sudo apt-get update
# install from the Docker repo instead of the default Ubuntu 16.04 repo
@spdin
spdin / ieee754_converter.py
Last active October 31, 2019 10:53
IEEE 754 Converter
# https://stackoverflow.com/questions/8751653/how-to-convert-a-binary-string-into-a-float-value
# http://weitz.de/ieee/
from codecs import decode
import struct
def bin_to_float(b):
""" Convert binary string to a float. """
bf = int_to_bytes(int(b, 2), 8) # 8 bytes needed for IEEE 754 binary64.
@spdin
spdin / python_collection.py
Last active January 16, 2020 03:35
List of collection of Python Snippet
# get actual name of file before extension
file = 'my.report.txt'
print file.rsplit('.', 1)[0]
# list of comprehension
words = [w.replace('[br]', '<br />') for w in words]
# get intersection of list
def intersection(lst1, lst2):
temp = set(lst2)
@spdin
spdin / collection.sh
Last active February 9, 2021 05:17
Collection of Ubuntu Command Line
# Get amount of directories and files
tree <FOLDER_NAME>/ | tail -1
# get amount of file
find . | wc -l
# zip file
zip -r output_file.zip file1 folder1
# add -q for quiet operation
zip -q -r output_file.zip file1 folder1
@spdin
spdin / move_random.py
Last active July 28, 2023 22:52
Pick and move file to another folder randomly
import os, random, shutil
#Prompting user to enter number of files to select randomly along with directory
source=input("Enter the Source Directory : ")
dest=input("Enter the Destination Directory : ")
no_of_files=int(input("Enter The Number of Files To Select : "))
print("%"*25+"{ Details Of Transfer }"+"%"*25)
print("\n\nList of Files Moved to %s :-"%(dest))