Skip to content

Instantly share code, notes, and snippets.

View johnnymillergh's full-sized avatar
💪
Coding & Building

Johnny Miller johnnymillergh

💪
Coding & Building
View GitHub Profile
@johnnymillergh
johnnymillergh / getLocalIP.js
Created July 7, 2019 01:48 — forked from hectorguo/getLocalIP.js
Get local IP address through Javascript
/**
* Get Local IP Address
*
* @returns Promise Object
*
* getLocalIP().then((ipAddr) => {
* console.log(ipAddr); // 192.168.0.122
* });
*/
function getLocalIP() {
@johnnymillergh
johnnymillergh / index.js
Last active August 20, 2020 06:08
Proxy and reflect in JavaScript
/**
* Observe an object by proxy
* @param {*} object
* @param {function} callback function
* @returns {Proxy} the proxy of object
*/
function observe (object, callback) {
return new Proxy(object, {
get (target, key, receiver) {
return Reflect.get(target, key, receiver)
@johnnymillergh
johnnymillergh / edas-startup.cmd
Last active December 14, 2020 06:08
EDAS startup command for Windows
@echo on
setlocal
@REM UTF-8
chcp 65001
cls
set SERVER_IP=""
if not "%JRE_HOME%" == "" goto gotJreHome
if not "%JAVA_HOME%" == "" goto gotJavaHome
SELECT *
FROM user
WHERE username LIKE '%/_%' ESCAPE '/';
SELECT *
FROM user
WHERE username LIKE '%\_%';
// This file was initially generated by Windows Terminal 1.3.2651.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@johnnymillergh
johnnymillergh / 1. Proxy Domain or IP.txt
Last active March 3, 2025 09:18
V2ray Configuration
===== Domain =====
geosite:google,
geosite:apple,
geosite:microsoft,
geosite:facebook,
geosite:twitter,
geosite:telegram,
geosite:geolocation-!cn,
geosite:tld-!cn,
domain:github.com,
@johnnymillergh
johnnymillergh / index.txt
Last active July 18, 2021 12:36
Windows 10 Docker Errors & Solutions on WSL2
https://github.com/docker/for-win/issues/3171#issuecomment-554587817
This is /obviously/ not docker's problem (as best I can tell), it's probably not even hyperv's. Commenting here as this seems to be a frustrating and common end of journey for googlers. What follows is at least "one" of the resolutions/explanations.
On one of my machines the dynamic port range was not updated to the "new" start port, and I guess related to a resolved bug in windows has now "exposed" this as a serious problem (e.g.: I couldn't even bind to port 3000 for node dev -- access denied is I think a valid response, but it's not the typical "port in use" root cause).
Current dynamic port config:
> netsh int ipv[46] show dynamicport tcp
Unless you know you've mucked with these settings, and if it doesn't specify 49152 as "Start Port" and is set to 1025, it's not "current". I don't know if there is some kind of migration bug when they were patching this new value or what. Dynamic start port for udp was set correctly for example.
@johnnymillergh
johnnymillergh / docker-initialization-for-mac-linux.md
Last active March 12, 2021 14:13
Docker Initialization Command

Docker Image Initialization (Mac)

Basically, these command is doing mapping local host’s file system to docker container.

[TOC]

Command Instructions: docker run

docker run --help
@johnnymillergh
johnnymillergh / index.md
Last active April 20, 2021 01:24
Regular Expression Collection

Regular Expression Collection

Password with 3 types of character: alphabet, number, and special character.

const passwordRegExp = /^(?=.*([a-zA-Z].*))(?=.*[\d].*)(?=.*[!@#$%^&*\-+].*)[a-zA-Z\d!@#$%^&*\-+]{12,20}$/
@johnnymillergh
johnnymillergh / auto-run-windows-for-compressed-zip.cmd
Last active September 13, 2021 07:16
Windows CMD Batch Script
@ECHO OFF
@REM ############################## auto-run ############################
@REM # Author: 钟俊, date: 2021-09-13 11:14:14.337 #
@REM # Copyright (c) 钟俊 #
@REM # Capability: Windows 10 Pro (20H2) #
@REM # Purpose: #
@REM # 1. Integrate easy and simple deployment, #
@REM # 2. Improve the efficiency of publishing frontend project (zip).#
@REM ####################################################################