Skip to content

Instantly share code, notes, and snippets.

# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
# Tap needed repos
brew tap homebrew/cask-fonts
# Install some stuff from Homebrew
brew install --cask \
alex313031-thorium \
@victor141516
victor141516 / pubg-intros.bat
Created July 26, 2023 21:28
Disable PUBG intros
@echo off
setlocal
:: Define the path to the directory
:: This is my install directory. By default it's installed in C:\Program Files (x86)\Steam\steamapps\common\PUBG\TslGame\Content\Movies
set "directory=C:\SteamLibrary\steamapps\common\PUBG\TslGame\Content\Movies"
:: Define the paths to the files
set "file1=%directory%\LicenseScreen.mp4"
set "file2=%directory%\LoadingScreen.mp4"
@victor141516
victor141516 / colors.html
Created May 23, 2023 13:52
hex colors that look like spanish words
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Colors</title>
<style>
body {
function Assign-VMGPUPartitionAdapter {
param(
[string]$VMName,
[string]$GPUName,
[decimal]$GPUResourceAllocationPercentage = 100
)
$PartitionableGPUList = Get-WmiObject -Class "Msvm_PartitionableGpu" -ComputerName $env:COMPUTERNAME -Namespace "ROOT\virtualization\v2"
if ($GPUName -eq "AUTO") {
$DevicePathName = $PartitionableGPUList.Name[0]
@victor141516
victor141516 / styles.css
Last active May 11, 2023 10:40
VSCode custom css
/* the buttons on the right of the file tabs */
[id="workbench.parts.editor"] .title-actions ul > li:has(:not(.codicon-close-dirty)) {
display: none !important;
}
/* the buttons on the right of the window title */
.titlebar-right .monaco-toolbar {
display: none !important;
}
@victor141516
victor141516 / forward.sh
Created April 20, 2023 11:14
Traffic forwarding Docker
#!/bin/sh
function forward_container() {
docker run -it --rm \
-p $OUTSIDE_PORT:$INSIDE_PORT \
--network $NETWORK_NAME \
alpine/socat \
tcp-listen:$INSIDE_PORT,fork,reuseaddr tcp-connect:$CONTAINER_NAME:$INSIDE_PORT
}
@victor141516
victor141516 / book-copy.js
Created November 17, 2022 14:42
Copy text from Google Play Books
// Select the proper frame in devtools and run this script
const nextPageButton = Array.from(document.querySelectorAll('mat-icon')).find((e) => e.innerHTML === 'chevron_right');
const getCurrentPageText = () => Array.from(document.querySelectorAll('reader-page'))
.filter(e => e.checkVisibility())
.map((e) => e.textContent)
.join('');
const isLastPage = () => nextPageButton.classList.contains('mat-button-disabled');
@victor141516
victor141516 / recursive-proxy.js
Created October 11, 2022 11:28
Recursive proxy for debugging purposes
(() => {
const a = (prefix = '') =>
new Proxy(
{},
{
get(_, p) {
const newPrefix = [prefix.toString(), p.toString()].join('.');
console.log('get: ', newPrefix);
return a(newPrefix);
},
@victor141516
victor141516 / carrefour-purchases.js
Created May 2, 2022 12:52
get purchases items from carrefour spanish web
import fetch from "node-fetch";
import { writeFileSync } from "fs";
const HEADERS = {/* copy from chrome */};
const getPurchaseItems = async (id) => {
console.log("getting purchase:", id);
const prom = fetch(
`https://api.carrefour.es/marketing-digital/prod/tickets/${id}`,
{
@victor141516
victor141516 / pathize.js
Created January 17, 2022 19:34
Returns an object with the same structure as obj but each value is the path to the key
/**
*
* @param {any} obj The input object
* @param {string[]} exceptions List of keys not to convert
* @param {string} basePath Base string to use for the path
* @returns {any} Returns an object with the same structure as obj but each value is the path to the key
* @example pathize({a: {b: {c: 2}}, d: 3, e: 4}, ['e'], 'base') ==> {a: {b: {c: 'base.a.b.c'}}, d: 'base.a.d', e: 4}
*/
function pathize(obj, exceptions = [], basePath = '') {
const clone = JSON.parse(JSON.stringify(obj))