Skip to content

Instantly share code, notes, and snippets.

View victornpb's full-sized avatar
⌨️

Victor victornpb

⌨️
View GitHub Profile
@victornpb
victornpb / Fixing MacMini 2012 Platform Controller Heatsink gap.md
Created July 28, 2022 16:17
Fixing MacMini 2012 Platform Controller Heatsink gap

Fixing MacMini 2012 Platform Controller Heatsink gap

63K5OtKJ2rQ2OIHR

Intel HM77 (SLJ8C) platform controller hub

I measured the gap to be just a little bit higher than 0.15mm (I couldn’t fit the 0.2 filler gauge). So I tried to shim it with something, aluminum foil is definitely not enough you would need more than 10 layers. So the closest thing I had was a Coke can, I cut a square piece and remove the paint and inner coating with steel wool, trim it to 14x14mm.

it turned out to be 0.1mm, (don’t use 2 layers it will be too thick). add thermal paste to both sides. So the thermal paste only has to fill a gap about 0.025 on each side instead of a massive 0.2 gap.

@victornpb
victornpb / gist:18862258e8b3fe84737a4537f900d394
Last active May 22, 2021 22:14
LG 4K UHD 27MU58P-B.AWZ

LG 4K UHD 27MU58P-B.AWZ

Display Calibration

  • [Picture]
    • Picture Mode: Custom
    • Picture Adjust >
      • Super Resolution: Off (Use Low for 1080p)
      • Sharpness: 50
      • Black Level: Low
  • HDMI ULTRA HD Deep Color: Off
/**
* Human readable elapsed or remaining time (example: 3 minutes ago)
* @param {Date|Number|String} date A Date object, timestamp or string parsable with Date.parse()
* @return {string} Human readable elapsed or remaining time
* @author github.com/victornpb
*/
function fromNow(date) {
const SECOND = 1000;
const MINUTE = 60 * SECOND;
const HOUR = 60 * MINUTE;
@victornpb
victornpb / clone_all.sh
Last active March 31, 2021 04:29
Clone All repositories from User or Organization
#!/bin/bash
echo "-------------------------------"
echo " Clone all GitHub Repositories "
echo "-------------------------------"
#prompt for variables
printf "\nCreate a token here https://github.com/settings/tokens\nor leave it empty for public repositories\n\n"
read -s -p 'Personal Token (optional): ' GITHUB_TOKEN
printf "\n"
@victornpb
victornpb / Backup Arduino firmware.md
Last active December 27, 2021 05:47
Arduino backup

Set these variables

Arduino Uno:

export BOARD=atmega328p
export PORT=/dev/tty.usbmodem14201
export BAUD=115200
export PROGRAMMER=arduino
export AVR_DIR=/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin
@victornpb
victornpb / start_server.command
Last active June 6, 2022 13:49
Bash script to start Minecraft server and keep it running if it crashes
#!/bin/bash
# Config
WINDOW_TITLE="Minecraft Server"
ONLINE_AUTH=true
RAM_INITIAL=512M
RAM_MAX=4G
RESTART_DELAY=10
################################################################################
@victornpb
victornpb / frozen-task.js
Last active February 26, 2020 14:14
Bookmarklet to make frozen tasks more effortless
(() => {
if (window.MOD) return alert("Already running!");
window.MOD = true;
const doc = document;
doc.querySelector("#toggle-side-nav").click();
doc.querySelector("nav").style.position = "absolute";
const delay = async t => new Promise(r => setTimeout(r, t));
const wait4Elm = async selector => {
@victornpb
victornpb / remove-outline-focus-ring.js
Last active February 6, 2020 00:32
Remove the focus outline ring when using mouse but keep it for keyboard users for a11y
/**
* Hide the uggly focus outline ring on UI elements for users using mouse
* as input device, but enable it as soon as the keyboard is being used.
* This is important for keyboard and a11y purposes.
* @author https://gist.github.com/victornpb/0aa4aba6e15a2f156a53a7ba995a432e
*/
(function () {
document.head.appendChild(document.createElement("style")).innerHTML =
"body.hide-focus-ring *:focus { outline: none !important; }";
@victornpb
victornpb / zip.js
Created December 18, 2019 18:39
Zip file on nodeJS using subprocess
const path = require('path');
const { spawn } = require('child_process');
(async () => {
try {
await zip(path.resolve(__dirname, 'foo.js'), path.resolve(__dirname, 'bar.zip'));
console.log('OK');
} catch (err) {
console.error('Failed to zip!', err);
@victornpb
victornpb / parseQueryString.js
Created October 16, 2019 19:25
Simple query string parser
/*
Example:
parseQueryString('?foo=hi&bar=World%20Hello')
{
foo: "hi",
bar: "Hello World"
}
*/
/**