Skip to content

Instantly share code, notes, and snippets.

View by-nari's full-sized avatar
🏠
Working from home

Nari by-nari

🏠
Working from home
  • Midgard
View GitHub Profile
@by-nari
by-nari / lazy-load-puppeteer.js
Created September 17, 2023 07:04 — forked from schnerd/lazy-load-puppeteer.js
Lazy-loading content in Puppeteer
function wait (ms) {
return new Promise(resolve => setTimeout(() => resolve(), ms));
}
export default async function capture(browser, url) {
// Load the specified page
const page = await browser.newPage();
await page.goto(url, {waitUntil: 'load'});
// Get the height of the rendered page

Setup

  • Create a developer account with Apple
  • Download and install X-Code from the Apple App Store
  • Open and run X-Code app and install whatever extras it requires
  • Open the preferences pane (cmd+,)
    • click the + in the lower right corner
    • choose Apple ID
    • enter your apple ID and password
@by-nari
by-nari / hdrtosdr.sh
Created September 6, 2022 14:18 — forked from SCG82/hdrtosdr.sh
Convert HDR video to SDR with tone mapping (especially for iPhone 12)
#!/bin/bash
#************************************************
# hdrtosdr.sh *
# v1.0.0 *
# developer: SCG82 ([email protected]) *
#************************************************
USAGE_S="Usage: $0 -s [start time hh:mm:ss] -e [end time hh:mm:ss] -w width -h height -p preset FILE"
USAGE="Usage (arguments are optional): $0 -s [start time hh:mm:ss] -e [end time hh:mm:ss] -w [output width] -h [output height] -p [preset: ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow,placebo] FILE"
@by-nari
by-nari / gist:c6fbcacbb68ec7f07850557143b118bf
Created December 31, 2021 04:01
Install Go on Amazon Linux ARM
wget https://go.dev/dl/go1.17.5.linux-arm64.tar.gz
sudo tar -C /usr/local/ -xzf go1.17.5.linux-arm64.tar.gz
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$GOROOT/bin
@by-nari
by-nari / nosync.sh
Created December 14, 2021 08:42
Crawl computer for node_modules, add .nosync file
find ~ -type d -name node_modules -exec touch {}/.nosync \;
@by-nari
by-nari / systemd_service_hardening.md
Created December 9, 2021 01:59 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@by-nari
by-nari / decrypt.js
Created October 1, 2021 03:05
retrieve Chrome cookies on Windows then decrypt
const dpapi = require("win-dpapi")
const sqlite3 = require("sqlite3")
const os = require("os")
const fs = require("fs")
const crypto = require("crypto")
const path =
os.homedir() + `\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Cookies`
db = new sqlite3.Database(path)

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@by-nari
by-nari / remove_GPS_coordinates_from_EXIF.sh
Last active July 27, 2021 17:31
Remove all GPS coordinates of *.heic files, include sub directories.
exiftool -gps:all= -r -ext heic .
@by-nari
by-nari / I_will_find_you_and_I_will_kill_you.sh
Last active April 6, 2021 11:20
Find files that are smaller than 50 bytes then delete it
# Count: find . -type f -size -50c -printf 1 | wc -c
# `b' for 512-byte blocks (this is the default if no suffix is used)
# `c' for bytes
# `w' for two-byte words
# `k' for Kilobytes (units of 1024 bytes)
# `M' for Megabytes (units of 1048576 bytes)
# `G' for Gigabytes (units of 1073741824 bytes)
find . -type f -size -50c -delete