Skip to content

Instantly share code, notes, and snippets.

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

Lenin Hasda leninhasda

🏠
Working from home
View GitHub Profile
@leninhasda
leninhasda / count-files.py
Created May 11, 2018 05:45
Simple python script to count files in directory - v2
#!/usr/bin/env python3
import argparse, os, sys
from os.path import isdir, join, getsize
from pprint import pprint
def main():
# initiate the parser
parser = argparse.ArgumentParser(description="count files in given directory")
@leninhasda
leninhasda / count-files.py
Created April 19, 2018 11:25
Simple python script to count files in directory.
#!/usr/bin/env python
import os, sys
def countFilesRecursive(dirname):
cnt = 0
for file in os.listdir(dirname):
fullpath = os.path.join(dirname, file)
if os.path.isdir(fullpath):
cnt = cnt + countFilesRecursive(fullpath)
@leninhasda
leninhasda / shell-exec.go
Last active February 12, 2018 09:47
Handy little go func for executing shell command
func ShellExec(args ...string) (string, string, error) {
cmd := exec.Command(args[0], args[1:]...)
stderr, err := cmd.StderrPipe()
if err != nil {
return "", "", err
}
stdout, err := cmd.StdoutPipe()
if err != nil {
return "", "", err
@leninhasda
leninhasda / colors.css
Created March 14, 2017 05:42
Materialize CSS Framework provides beautiful bundle of preset colors, and this is just the color portion of full framework.
/*
* This is only the colors of Materialize CSS Framework
*
* Materialize v0.98.0 (http://materializecss.com)
* Copyright 2014-2015 Materialize
* MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
*/
.materialize-red{background-color:#e51c23!important}.materialize-red-text{color:#e51c23!important}.materialize-red.lighten-5{background-color:#fdeaeb!important}.materialize-red-text.text-lighten-5{color:#fdeaeb!important}.materialize-red.lighten-4{background-color:#f8c1c3!important}.materialize-red-text.text-lighten-4{color:#f8c1c3!important}.materialize-red.lighten-3{background-color:#f3989b!important}.materialize-red-text.text-lighten-3{color:#f3989b!important}.materialize-red.lighten-2{background-color:#ee6e73!important}.materialize-red-text.text-lighten-2{color:#ee6e73!important}.materialize-red.lighten-1{background-color:#ea454b!important}.materialize-red-text.text-lighten-1{color:#ea454b!important}.materialize-red.darken-1{background-color:#d0181e!important}.materializ
@leninhasda
leninhasda / auto-move-downloads.py
Created December 3, 2016 19:32
utility script to automatically move the specified files from downloads directory to proper directory
# import
import os
from os import path, listdir as list_dir, rename as move
from os.path import isdir as is_dir, isfile as is_file
from pprint import pprint
import shutil
# global variables
#==================
@leninhasda
leninhasda / Default.sublime-keymap
Created October 25, 2015 13:52
My keybindings for sublime text editor
[
{ "keys": ["alt+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"}},
{ "keys": ["alt+x"], "command": "toggle_side_bar" },
{ "keys": ["alt+a"], "command": "focus_side_bar" },
{ "keys": ["f4"], "command": "reindent"},
{ "keys": ["ctrl+e"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }
]
@leninhasda
leninhasda / Preference.sublime-settings
Created October 25, 2015 13:50
My User settings for sublime test editor
{
"bold_folder_labels": true,
"caret_extra_width": 2,
"caret_style": "wide",
"color_scheme": "Packages/Theme - Spacegray/base16-eighties.dark.tmTheme",
"fade_fold_buttons": false,
"font_face": "Monaco",
"font_size": 12,
"highlight_line": true,
"highlight_modified_tabs": true,
@leninhasda
leninhasda / base
Last active August 29, 2015 14:27
a simple .sh file that i use to create new virtual host and directory structure in nginx for web application.
server {
listen 80;
listen [::]:80;
root /home/lenin/dev/devfolderroot/web;
index index.php index.html index.htm;
server_name domainname;
location / {