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
@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))
@spdin
spdin / api_request.php
Last active October 16, 2019 18:58
API end point request using PHP
<?php
include 'config.php';
use GuzzleHttp\Client;
require 'vendor/autoload.php';
$client = new Client();