setsid ngrok tcp <port> &>/dev/null </dev/null
optional, if you want store the log, enable ngrok option --log=stdout
node -pe 'JSON.parse(process.argv[1])' $(curl -s http://localhost:4040/api/tunnels)
# atau
const socket = new WebSocket("ws://localhost:8080") | |
socket.onopen = function (e) { | |
alert('[open] connection established') | |
alert('sending data to server') | |
socket.send('My name is who am i?'); | |
} | |
socket.onmessage = function (ev) { | |
alert(`[message] data received from srv: ${ev.data}`); |
#!/bin/sh | |
threshold=10 # threshold percentage to trigger alert | |
while :; do | |
capacity=$(cat /sys/class/power_supply/BAT1/capacity) | |
# If battery is discharging with capacity below threshold | |
if [ "${capacity}" -lt ${threshold} ];then | |
# Send a notification that appears for 300000 ms (5 min) |
#!/usr/bin/sh | |
watch -n 0.1 "date +\"%d-%m-%Y %H:%M:%S.%9N\"" |
const { get } = require("node:https"); | |
(async () => { | |
const stickerName = ['Elaina_san', 'bagasgoyang'] | |
const token = "bot7003873933:AAFKl0LwWViMJIA34-qjbTh7nZwcNQr2hFs" | |
const domain = "https://api.telegram.org" | |
const file_baseurl = `${domain}/file/${token}` | |
const api_baseurl = `${domain}/${token}` | |
stickerName.forEach(async (name) => { |
const { get } = require("node:https") | |
require('dotenv').config(); | |
function fetch(url) { | |
return new Promise((resolve, reject) => { | |
get(url, (res) => { | |
let buff = Buffer.alloc(0); | |
res.on("data", chunk => buff = Buffer.concat([buff, Buffer.from(chunk)])) | |
res.on("error", reject) | |
res.on("end", () => resolve(buff)) |
const { spawn } = require('node:child_process') | |
const readline = require('node:readline'); | |
const { stdin: input, stdout: output } = require('node:process'); | |
const rl = readline.createInterface({ input, output }); | |
const shell = spawn('sh') | |
shell.stdout.on('data', (data) => { | |
process.stdout.write(data.toString()) |
The idea came from Nir Lichtman video with the title: 'Making Simple Linux Distro from Scratch'
this gist just re-document it in the form of text
Live Boot arch linux:
qemu-system-x86_64 \
-drive format=raw,file=./archlinux-2024.04.01-x86_64.iso,index=0,media=disk \
-enable-kvm -machine pc -cpu host -m 1G -nographic
Since the above command using -nographic
, so we don't start VNC server, thus don't forget to add console=ttyS0
to kernel parameter, press on the bootloader to modify kernel parameter
not related link: