Skip to content

Instantly share code, notes, and snippets.

View victornpb's full-sized avatar
⌨️

Victor victornpb

⌨️
View GitHub Profile
@victornpb
victornpb / start_server.command
Last active April 20, 2024 13:52
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 / deleteDiscordMessages.js
Last active April 16, 2024 09:32
Delete all your messages from DM or Channel in Discord
/*
This file is now hosted here:
https://github.com/victornpb/undiscord
*/
@victornpb
victornpb / pedrapapeltesoura.c
Last active February 19, 2024 22:21
Joguinho do Pedra-papel-tesoura criado por Victor B. em 1-dec-2014 para ministrar linguagem C de programação aos alunos do curso de robotica e automacao 2014 no UNICERP.
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define PEDRA 1
#define PAPEL 2
#define TESOURA 3
int pontosJogador;
int pontosComputador;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* AES implementation in JavaScript (c) Chris Veness 2005-2014 / MIT Licence */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* jshint node:true *//* global define */
'use strict';
/**
* AES (Rijndael cipher) encryption routines,
@victornpb
victornpb / v-tooltip.js
Last active July 6, 2023 06:28
Using Bootstrap tooltips in Vue.js with a simple directive
/**
* Enable Bootstrap tooltips using Vue directive
* @author Vitim.us
* @see https://gist.github.com/victornpb/020d393f2f5b866437d13d49a4695b47
* @example
* <button v-tooltip="foo">Hover me</button>
* <button v-tooltip.click="bar">Click me</button>
* <button v-tooltip.html="baz">Html</button>
* <button v-tooltip:top="foo">Top</button>
* <button v-tooltip:left="foo">Left</button>
@victornpb
victornpb / occurrences.js
Last active June 7, 2023 14:37
Function count the occurrences of substring in a string
/** Function that count occurrences of a substring in a string;
* @param {String} string The string
* @param {String} subString The sub string to search for
* @param {Boolean} [allowOverlapping] Optional. (Default:false)
*
* @author Vitim.us https://gist.github.com/victornpb/7736865/edit
* @see Unit Test https://jsfiddle.net/Victornpb/5axuh96u/
* @see http://stackoverflow.com/questions/4009756/how-to-count-string-occurrence-in-string/7924240#7924240
*/
function occurrences(string, subString, allowOverlapping) {
@victornpb
victornpb / String.format().js
Last active January 10, 2023 17:17
String.format() that supports argument list, array, objects, and nested objects.
if (!String.prototype.format) {
/**
* formats a string replacing tokens with an argument list, array, objects, and nested objects.
* @args Can be a list of arguments, array or object
*
* Usage:
* "hello {0} world {0}!".format("foo", "bar"); //"hello foo world bar"
* "hello {0} world {0}!".format(["foo", "bar"]); //"hello foo world bar"
* "hello {name} world {test}!".format({name: "foo", test: "bar"}); //"hello foo world bar"
* "hello {obj.name} world {obj.test[0]}!".format({obj:{name: "foo", test: ["bar"]}}); //"hello foo world bar"
@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 / 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 / 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