This is a quick way to find a random free port on a system using PHP:
$port = find_free_port();
Benchmarked locally, where finding a port always took around 0.15ms.
/** | |
* project : Led Blink (kedap kedip genit) | |
* publish : Agustus 2021 | |
* author : ian <cikaldev@gmail.com> | |
* homepage: https://t.me/@lua_indonesia | |
* | |
* Bahan : | |
* - 1x NodeMCU ESP8266 WiFi V3 | |
* - 1x Led 3mm / 5mm | |
* - 1x Kapasitor ~220/320 ohm (pake yang 1k juga jadi) |
package main | |
import ( | |
"fmt" | |
"github.com/gorilla/mux" | |
"github.com/gorilla/securecookie" | |
"net/http" | |
) | |
// cookie handling |
package main | |
import ( | |
"github.com/webview/webview" | |
"encoding/json" | |
"fmt" | |
"net" | |
"net/http" | |
"runtime" |
<?php | |
/** | |
* My Helper | |
* @author cikaldev | |
*/ | |
if (!function_exists('uuidv4')) { | |
/** | |
* Method UUID v4 | |
* ex: 19bde5a4-b17e-4b46-8930-0bbeb3d197cf | |
* @return String(36) |
Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.
You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.
/** | |
* @author Ian Cikal (@cikaldev) | |
* @description Get Free random PORT Number NodeJS. | |
*/ | |
const net = require("net"); | |
async function getFreePort() { | |
return new Promise((resolve, reject) => { | |
const srv = net.createServer(); | |
srv.listen(0, () => { |
@echo off & set GOLUWA_START_TIME="%time%" & PowerShell -nologo -noprofile -noninteractive Invoke-Expression ('$args=(''%*'').split('' '');'+'$PSScriptRoot=(''%~dp0'');$env:GOLUWA_CURRENT_DIRECTORY=(''%cd%'');'+((Get-Content -Raw '%~dp0%~n0%~x0' ) -Replace '^.*goto :EOF')); & goto :EOF | |
# ^^^^^ | |
# this is some magic to execute the rest of this cmd as powershell | |
# so we can run it from explorer with double click or cmd easily | |
function Download($url, $location) { | |
Write-Host -NoNewline "'$url' >> '$location' ... " | |
(New-Object System.Net.WebClient).DownloadFile($url, "$location") | |
Write-Host "OK" |
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers']) | |
.run(function(DB) { | |
DB.init(); | |
}); |
const http = require('http'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const fileLocation = path.join(__dirname, 'video.mp4'); | |
fs.writeFileSync(fileLocation, ''); | |
const file = fs.createWriteStream(fileLocation); | |
function printSize(bytes) { |