Skip to content

Instantly share code, notes, and snippets.

View mkp246's full-sized avatar

Manoj Kumar mkp246

View GitHub Profile
@mkp246
mkp246 / timed_start.bat
Last active January 11, 2019 05:55
If you are using office Laptop and don't want to run office specific programs at startup when you are outside of office time or weekend
@echo off
setlocal enableextensions enabledelayedexpansion
SETLOCAL
set ctime=%time: =0%
set inoffice=y
if "%ctime%" lss "09:00:00,00" ( set "inoffice=" )
if "%ctime%" geq "18:00:00,00" ( set "inoffice=" )
for /F "skip=2 tokens=2-4 delims=," %%A in ('WMIC Path Win32_LocalTime Get DayOfWeek /Format:csv') do set daynumber=%%A
if /I %daynumber% EQU 6 set notofficeday=y
@mkp246
mkp246 / path.ahk
Last active November 17, 2017 07:25
CTRL+SHIFT+C copies selected file/directory paths to clipboard in windows explorer and CTRL+ALT+T on windows explorer opens cmd there(non-admin)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#NoTrayIcon
#SingleInstance force
#IfWinActive ahk_class CabinetWClass
^+c:: Explorer_GetSelection()
Explorer_GetSelection(hwnd="") {
hwnd := hwnd ? hwnd : WinExist("A")
WinGetClass class, ahk_id %hwnd%
if (class="CabinetWClass" or class="ExploreWClass" or class="Progman")
def rawPomUrl ="<raw pom Url"
def pom = new URL(rawPomUrl).getText()
def xmlRootNode = new XmlParser().parseText(pom)
def jsonText = '''{
"disable_edit_json": true,
"disable_properties": true,
"no_additional_properties": true,
"disable_collapse": true,
"disable_array_add": true,
download and install android studio
download sdk-tools-windows.zip
extract to dir c:/android/sdk, no spaces in path
from sdk dir in cmd, run
.\tools\bin\sdkmanager.bat --proxy=http --proxy_host=<proxy_host> --proxy_port=<proxy_port> --verbose --list
note down packes to be installed
run the commnd to install the packages
.\tools\bin\sdkmanager.bat --sdk_root=. --proxy=http --proxy_host=<proxy_host> --proxy_port=<proxy_port> --verbose --install tools "build-tools;28.0.3" docs emulator "platforms;android-28" "sources;android-28" "system-images;android-28;default;x86_64"
@mkp246
mkp246 / SSLSocketEchoServer.java
Last active September 13, 2022 05:20
java ssl echo server
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.security.cert.Certificate;
import javax.net.ServerSocketFactory;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLServerSocket;
@mkp246
mkp246 / path-v2.ahk
Last active October 28, 2022 05:43
ctrl+space : always on top, ctrl+shift+c : copy selection path in explorer, ctrl+alt+t : launch cmd in current dir like ubuntu
#NoTrayIcon
#SingleInstance Force
SendMode "Input"
^Space:: WinSetAlwaysOnTop -1, WinExist("A")
^+c:: winExplorerGetSelectionPaths()
^!t:: launchCmd()
winExplorerGetSelectionPaths() {
if(WinActive("ahk_class CabinetWClass")) {