Skip to content

Instantly share code, notes, and snippets.

View 0x524c's full-sized avatar

0x524c 0x524c

  • Brazil
  • 18:53 (UTC -03:00)
  • X @0x524c
View GitHub Profile
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@0x524c
0x524c / IndexedDB101.js
Created September 24, 2022 19:51 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@0x524c
0x524c / node-sass.md
Created April 12, 2022 00:51 — forked from tandavala/node-sass.md
Como usar sass com node js

node-sass

Sass é uma linguagem de script que é interpretada ou compilada em Cascading Style Sheets (CSS). e neste GIST estarei demonstrando como usar sass com node js.

Primeiro passo

Iniciar um projecto do zero com a framework express

mkdir node_sass
@0x524c
0x524c / a-qemu-install-debian-arm64.sh
Created February 16, 2022 14:48 — forked from penglei/a-qemu-install-debian-arm64.sh
run qemu-aarch64 on macOS
#!/bin/bash
#qemu-img create -f qcow2 disk.qcow2 20G
#qemu-img create -f qcow2 varstore.img 128M
debian_iso=debian-9.6.0-arm64-xfce-CD-1.iso
qemu-system-aarch64 -smp cpus=6 -M virt -cpu max -m 2G -nographic \
-drive file=QEMU_EFI.img,if=pflash,format=raw \
-drive file=varstore.img,if=pflash \
-drive file=disk.qcow2,if=virtio \
-drive file=$debian_iso,if=virtio,format=raw
@0x524c
0x524c / gist:de362864268c650b42d2b244ee55da04
Created February 6, 2022 23:36 — forked from tingleshao/gist:cae2a764c60e3d002c68bb7f779489c4
ffmpeg compress with certain bitrate and resolution
ffmpeg -i jellyfish-120-mbps-4k-uhd-h264.mkv -c:v libx264 -profile:v main -vf scale=1920:1080 -b:v 50000k -an -tune fastdecode -coder 0 -flags -loop -g 30 -bf 0 -t 10 jellyfish-hd-50mbps_main_nosound_fast_short.mp4
@0x524c
0x524c / make_current_arm64_rpi_kernel_debs.sh
Created February 5, 2022 17:04 — forked from satmandu/make_current_arm64_rpi_kernel_debs.sh
Make arm64 deb packages for the offical Raspberry Pi Foundation arm64 kernels + NOW INSTALLS headers package too.
#!/bin/bash -x
# make_arm64_rpi_kernel_debs.sh
# Builds arm64 debian packages from the CURRENT rpi firmware repository kernel which is installed by:
# sudo rpi-update
# This runs on an arm64 host with arm64 compilation tools...
# or with some sort of cross-compilation setup.
# Debs are put in $workdir/build
#
# This will NOT work in Raspbian unless you have an arm64 compilation
# environment setup. Appears to work on
@0x524c
0x524c / compile-ffmpeg.sh
Last active April 19, 2022 10:12 — forked from wildrun0/compile-ffmpeg.sh
Compiling ffmpeg for Raspberry Pi 4 (script only works fine on RPIOS)
#!/bin/bash
# Note that there's no libdrm because this lib cause errors
sudo apt update -y && sudo apt upgrade -y
sudo apt-get -y install \
autoconf \
automake \
libgstreamer1.0-dev \
@0x524c
0x524c / defrag_ext4_filesystem.md
Created February 4, 2022 03:03 — forked from rmi1974/defrag_ext4_filesystem.md
How to optimize / defrag ext4 filesystem #ext4 #commandlinefu

How to optimize / defrag ext4 filesystem

Make sure the target filesystem is sane

Open up the terminal and run:

sudo fsck.ext4 -y -f -v /dev/<disk/partition>
# Kernel
kernel=zImage
#initramfs ramdisk.img 0x01f00000
# Audio
dtparam=audio=on
# Camera
#disable_camera_led=1
#gpu_mem=128
@0x524c
0x524c / update-ffmpeg-rpi.sh
Created January 25, 2022 00:42 — forked from enzanki-ars/update-ffmpeg-rpi.sh
Install/Update FFmpeg with hardware acceleration on the Raspberry Pi
#!/bin/bash
# Compile and install/update (or install via Apt) FFmpeg Codecs
# Compile and install/update FFmpeg suite
# Compile with hardware acceleration
# Modified from https://retroresolution.com/compiling-ffmpeg-from-source-code-all-in-one-script/
echo "Begining Installation of FFmpeg Suite"
#Update APT Repository
echo "Updating the APT repository information"