Skip to content

Instantly share code, notes, and snippets.

Avatar

Abhishek Kumar isurfer21

View GitHub Profile
@isurfer21
isurfer21 / app-cli.js
Created Jun 27, 2021
Simplest CLI based node.js app with in-built argument parser without any dependencies
View app-cli.js
const flags = { _: [] };
process.argv.forEach((s, e) => {
if (e >= 2)
if (/^[\-\-]{1,2}.+[\=\:].*$/.test(s)) {
let e = s.split(/[\=\:]/),
l = e[0].lastIndexOf("-");
l < 2 && (flags[e[0].substring(l + 1)] = e[1]);
} else if (/^[\-\-]{1,2}.+$/.test(s)) {
let e = s.lastIndexOf("-");
e < 2 && (flags[s.substring(e + 1)] = !0);
@isurfer21
isurfer21 / GFKeyFetcher.js
Last active Feb 18, 2020
GFKeyFetcher is a node.js based CLI tool to fetch input field label & name as key-value pair from Google Form
View GFKeyFetcher.js
/*
GFKeyFetcher
Google Form Key Fetcher
Copyright (c) 2014 Nistush Tech Solution.
Protected by Creative Commons license (CC BY 4.0).
@file GFKeyFetcher.js
@author Abhishek Kumar
*/
@isurfer21
isurfer21 / wspm.js
Last active Feb 18, 2020
Web Shell Package Manager
View wspm.js
/*
WSPM
Web Shell Package Manager
Copyright (c) 2020 Abhishek Kumar.
Protected by Creative Commons license (CC BY 4.0).
@file wspm.js
@author Abhishek Kumar
*/
@isurfer21
isurfer21 / duration.js
Created Feb 11, 2020
Calculates the exact duration in between 2 given dates.
View duration.js
/*
DURATION
Calculates the exact duration in between 2 given dates.
Copyright (c) 2020 Abhishek Kumar.
Protected by Creative Commons license (CC BY 4.0).
@file duration.js
@author Abhishek Kumar
*/
@isurfer21
isurfer21 / vitaarak.js
Last active Dec 11, 2019
Vitaarak is a zero dependency node.js based mime-type supported simple HTTP server with CLI and made for quick integration in any dev project.
View vitaarak.js
const http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs");
const mimeTypes = {
html: "text/html",
jpeg: "image/jpeg",
jpg: "image/jpeg",
png: "image/png",
@isurfer21
isurfer21 / logout
Created Sep 20, 2019
Logout from macOS via Terminal command
View logout
#!/usr/bin/env sh
sudo pkill loginwindow
@isurfer21
isurfer21 / goclean
Created Sep 20, 2019
Golang package cleaner
View goclean
#!/usr/bin/env sh
goclean() {
local pkg=$1; shift || return 1
local ost
local cnt
local scr
echo "Clean removes object files from package source directories (ignore error)"
go clean -i $pkg
@isurfer21
isurfer21 / tomcat
Last active Dec 11, 2019
Shell based Apache Tomcat agent
View tomcat
#!/usr/bin/env sh
APP_VER="19.9.20"
version() {
echo " Version $APP_VER \n"
}
help() {
echo "\n Apache Tomcat Agent version $APP_VER \n Copyright (c) 2019 Abhishek Kumar. All rights reserved."
echo "\n Options:"