Skip to content

Instantly share code, notes, and snippets.

View ndunks's full-sized avatar
💭
I'm programer and I have wife 😄

Mochamad Arifin ndunks

💭
I'm programer and I have wife 😄
View GitHub Profile
@ndunks
ndunks / webpack.external.js
Created June 21, 2019 12:45
Get list of excluded module in webpak config
module.exports = function(){
var fs = require("fs");
var nodeExternal = {};
var pkg = JSON.parse(fs.readFileSync('package.json', { encoding: 'utf-8' }));
Object.keys(pkg.dependencies).forEach(function (name) {
nodeExternal[name] = "require('" + name + "')";
});
Object.keys(pkg.devDependencies).filter(function (v) { return !v.match(/@types/); }).forEach(function (name) {
nodeExternal[name] = "require('" + name + "')";
});
@ndunks
ndunks / email-getnada.spec.ts
Created June 27, 2019 15:13
Getnada email client API for browser with typescript implementation
// Jasmine Standalone testing suite
import { GetnadaClient, ListResponse } from "./email-getnada";
(jasmine.getEnv() as any) .configure({random: false, oneFailurePerSpec: true, failFast: true});
let listResponse: ListResponse;
describe('Plugins testing getnada api client', () => {
const email = 'learner@getnada.com';
const api = new GetnadaClient(email);
@ndunks
ndunks / qemu-linux-host-to-guest-bridge.md
Created March 30, 2020 15:40
Qemu Linux setup host to guest network connection using bridge
sudo su
brctl addbr br0
ip addr add 192.168.3.100/24 dev br0
ip link set br0 up
[ -d /etc/qemu ] || mkdir /etc/qemu
touch /etc/qemu/bridge.conf
echo "allow br0" >> /etc/qemu/bridge.conf
@ndunks
ndunks / qemulate.sh
Created April 30, 2020 21:04
Qemu Change Hardisk Serial Number and Model
sudo qemu-system-i386 \
-m 512 \
-smp 1 \
-enable-kvm \
-drive if=none,id=disk00,format=qcow2,file=tmp/disk1.qcow2 \
-device "ide-hd,drive=disk00,bus=ide.0,serial=00000000000000000001,model=VMware Virtual IDE Hard Drive" \
-nic tap
@ndunks
ndunks / Modem 4G Cyborg
Last active February 18, 2021 15:59
Configuring 4G LTE Modem Cyborg Telkomsel Flash in Linux
# UDEV RULES
ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="92fe", RUN+="/usr/sbin/usb_modeswitch -v 05c6 -p 92fe -K"
ACTION=="add", SUBSYSTEM=="tty", KERNEL=="ttyUSB1", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9201", SYMLINK+="modem"
# IF No ttyUSBX found
sudo modprobe usbserial
echo 05c6 9201 | sudo tee /sys/bus/usb-serial/drivers/generic/new_id
@ndunks
ndunks / debian-10-minial-graphical.md
Last active February 20, 2021 14:55
based on Debian 10 Netinstall Minimal Desktop

sudo qemu-system-x86_64 -enable-kvm -smp 4 -m 2G -drive file=/dev/sdc,format=raw -serial mon:stdio -cdrom debian-10.8.0-amd64-netinst.iso -boot d

Packages

apt install --no-install-recommends xorg
apt install lightdm openbox chromium

Disable tty2-6

@ndunks
ndunks / alpine-linux-kiosk.md
Last active January 20, 2023 07:39
Install and setup Alpine Linux for Chromium Kiosk Mode using Qemu

Setup Alpine Linux

Make Disk Image

dd if=/dev/zero bs=1M of=disk.img count=1000

Formating Disk Image

cat <<EOF | sfdisk disk.img
@ndunks
ndunks / smsd
Last active March 2, 2021 08:03
Gammu SMS Daemon usb_modeswitch helper with Cyborg Mobile Broadband E488 4G LTE USB Stick (Telkomsel Flash)
#!/sbin/openrc-run
# Gammu SMS Daemon usb_modeswitch helper with Cyborg Mobile Broadband E488 4G LTE USB Stick (Telkomsel Flash)
retry="60"
pidfile="/var/run/$RC_SVCNAME.pid"
command="/usr/bin/gammu-smsd"
command_args="-d -p /var/run/$RC_SVCNAME.pid -c /etc/gammurc"
#command_background=true
#procname="gammu-smsd"
depend() {

Manual Mode

certbot certonly --manual --preferred-challenges dns-01 --manual-public-ip-logging-ok \
-m user@gmail.com -d '*.domain'

SSL RENEW

certbot renew
// IF using cookie, make sure the domain was added in "Cookie" -> Whitelist Domain
// Walk cookie
const cookie = pm.cookies.jar();
cookie.getAll(pm.request.url, (v1, cookies) => {
for (let v of cookies.map()) {
if (v.name.length > 32 && v.name.match(/[0-9a-f]/i)) {
pm.request.body.urlencoded.add({
key: v.name,
value: v.value