Skip to content

Instantly share code, notes, and snippets.

@astamicu
astamicu / Remove videos from Youtube Watch Later playlist.md
Last active May 4, 2024 16:14
Script to remove all videos from Youtube Watch Later playlist

UPDATED 22.11.2022

It's been two years since the last update, so here's the updated working script as per the comments below.

Thanks to BryanHaley for this.

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

 video.querySelector('#primary button[aria-label="Action menu"]').click();
@nikolovlazar
nikolovlazar / keybindings.json
Last active May 4, 2024 16:14
VSCode key bindings to navigate like Neovim
[
// Navigation
{
"key": "ctrl-h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl-l",
"command": "workbench.action.navigateRight"
},
@jmarhee
jmarhee / harvester-boot.sh
Created May 1, 2024 17:24
Boots a two-node Harvester cluster.
#!/bin/bash
CLUSTER_TAG=harvester-$(openssl rand -hex 6)
ISO=/var/lib/libvirt/images/harvester-v1.3.0-amd64.iso
for i in {1..2}; do \
VM_NAME=$(openssl rand -hex 4); \
sudo qemu-img create /var/lib/libvirt/images/${CLUSTER_TAG}-${VM_NAME}-ROOT_VOL.img 180G; \
sudo qemu-img create /var/lib/libvirt/images/${CLUSTER_TAG}-${VM_NAME}-DATA_VOL.img 250G; \
sudo virt-install \

Install Elemental with virt-install on KVM

Using virt-install to install SUSE Elemental on KVM.

Prerequisites

When creating your Machine Registration Endpoint in the Rancher UI, ensure that registration.emulated-tpm-seed is set to -1, if you plan to add more than a single machine using the ISO you will be building.

For example:

@adrianoluis
adrianoluis / DocumentUtil.java
Last active May 4, 2024 16:12
Utility class to validate CPF and CNPJ document types. For CPF use isValidSsn and for CNPJ use isValidTfn. Added to repo https://github.com/adrianoluis/misc-tools
public class DocumentUtil {
// CPF
private static final int[] WEIGHT_SSN = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
// CNPJ
private static final int[] WEIGHT_TFN = {6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2};
private static int sum(int[] weight, char[] numbers, int length) {
if (length <= 0) return 0;
@flaksp
flaksp / README.md
Last active May 4, 2024 16:07
Convert BitWarden JSON export file to Apple iCloud Keychain CSV import file saving TOTP and notes

BitWarden to Apple iCloud Keychain passwords converter

This Python scripts allows you to move your passwords from BitWarden to Apple iCloud.

You need to know:

  • It ignores secure notes, credit cards and other types that are not passwords.
  • It ignores BitWarden entries without usernames, passwords and URLs.
  • It also ignores URLs that do not start with http:// or https://.
  • It normalizes all TOTP tokens, e.g. wskg vtqa h5kl bhb4 v4v2 ybyo woc6 qme2 will be converted to otpauth://totp/example.com:dude@foo.bar?secret=WSKGVTQAH5KLBHB4V4V2YBYOWOC6QME2&amp;issuer=example.com&amp;algorithm=SHA1&amp;digits=6&amp;period=30.
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@rubyandcoffee
rubyandcoffee / Bootstrap - Rails 7
Last active May 4, 2024 16:06
Bootstrap with Rails 7
Adding Bootstrap to Rails 7
Reference: https://www.linkedin.com/pulse/rails-7-bootstrap-52-importmap-md-habibur-rahman-habib/
INSTRUCTIONS
1. Add the following to Gemfile:
gem "bootstrap"
gem "sassc-rails"
@pratikbutani
pratikbutani / country-flag.json
Created October 9, 2020 10:05
A JSON for Country List with Flag Image
[
{
"flag": "https://twemoji.maxcdn.com/2/svg/1f1e6-1f1e8.svg",
"country": "Ascension Island",
"code": "ac"
},
{
"flag": "https://twemoji.maxcdn.com/2/svg/1f1e6-1f1e9.svg",
"country": "Andorra",
"code": "ad"
@vladak
vladak / varmilo keyboard.md
Last active May 4, 2024 16:03
Varmilo keyboard details