Skip to content

Instantly share code, notes, and snippets.

View wsantos's full-sized avatar

Waldecir Santos wsantos

View GitHub Profile
@wsantos
wsantos / main.js
Created April 11, 2024 22:03 — forked from kdzwinel/main.js
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.
@Josasp
Josasp / edit_display.sh
Created January 14, 2022 10:37
Run with "sudo bash edit_display.sh" from Terminal. Requires VS Code installed.
#!/bin/bash
cd /Library/Preferences
BACKUP_NAME=com.apple.windowserver.displays_$(date +%F-%H_%M).plist
echo "Backing up plist to $BACKUP_NAME"
cp com.apple.windowserver.displays.plist $BACKUP_NAME
open_xml () {
echo "Converting plist to XML..."
plutil -convert xml1 com.apple.windowserver.displays.plist
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var styleEl = document.getElementById('css-layout-hack');
if (styleEl) {
styleEl.remove();
return;
}
styleEl = document.createElement('style');
styleEl.id = 'css-layout-hack';
@penglei
penglei / a-qemu-install-debian-arm64.sh
Last active April 5, 2023 09:07
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
@seanhandley
seanhandley / docker-compose.yml
Last active June 7, 2024 19:25
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@rakd
rakd / template.go
Created December 6, 2017 05:20
template inheritance for echo/golang
package main
import (
"fmt"
"html/template"
"io"
"log"
"os"
"path/filepath"
"strings"
@Morreski
Morreski / timed_cache.py
Last active July 3, 2024 16:29
Python lru_cache with timeout
from datetime import datetime, timedelta
import functools
def timed_cache(**timedelta_kwargs):
def _wrapper(f):
update_delta = timedelta(**timedelta_kwargs)
next_update = datetime.utcnow() + update_delta
# Apply @lru_cache to f with no cache size limit
@jbales
jbales / xhyve-freebsd-tutorial-1.md
Created March 31, 2016 04:14 — forked from tanb/xhyve-freebsd-tutorial-1.md
FreeBSD running on xhyve tutorial. (Appendix: Resize image with qemu. Create FreeBSD VM with qemu).

TL;DR

  • Create 5GB FreeBSD image.
  • Install FreeBSD on xhyve.
  • Mount host directory.

Requisites

@alirobe
alirobe / reclaimWindows10.ps1
Last active July 3, 2024 09:36
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@TonyStarkBy
TonyStarkBy / redis-idle-clean.lua
Last active May 13, 2020 08:51
redis: delete keys by idle time
-- how to use:
-- redis-cli EVAL "$(cat redis-idle-clean.lua)" 2 key_name 86400
local keyTemplate = KEYS[1]
local keyMinIdleTime = tonumber(KEYS[2])
local function getUsedMemory()
local info = redis.call('info')