Skip to content

Instantly share code, notes, and snippets.

@sdawood
sdawood / remove-all-youtube-liked-videos.js
Last active April 16, 2024 13:20
How to remove (unlike) all liked videos on youtube, June, 2023
/*
* inspired by https://gist.github.com/astamicu/eb351ce10451f1a51b71a1287d36880f
* modified to remove all liked Youtube videos and to work with Youtube as of June 2023
*/
setInterval(function () {
videos = document.getElementsByTagName('ytd-playlist-video-renderer');
// when a video is removed, the tag gets an 'is-dimissed' attribute, which tripped the original script
var notDismissedIndex = 0;
@McKabue
McKabue / ERROR.js
Last active April 16, 2024 13:20
Handling JavaScript Errors Like a boss by logging them to the server and possibly returning a behavior. WE THEN MAKE A REQUEST TO YOUR SERVERS AS IF YOU ARE LOADING A JAVASCRIPT FILE. THE URL WILL CONTAIN THE QUERY PARAMETERS THAT YOU WANT TO PASS TWO THE SERVER. THIS METHOD HAS TO ADVANTAGES: 1. THE CODE FOR SENDING THE REQUEST IS SIMPLE AS WE …
//https://developer.mozilla.org/en/docs/Web/API/GlobalEventHandlers/onerror
//https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror.html
//https://danlimerick.wordpress.com/2014/01/18/how-to-catch-javascript-errors-with-window-onerror-even-on-chrome-and-firefox/
window.onerror = function (messageOrEvent, source, lineno, colno, error) {
try {
console.log({
//error message(string).Available as event (sic!) in HTML onerror = "" handler.
messageOrEvent: messageOrEvent,
//URL of the script where the error was raised(string)
@Slach
Slach / backup-cronjob.yaml
Created April 16, 2024 13:17
clickhouse-backup CronJob examples
apiVersion: batch/v1
kind: CronJob
metadata:
name: clickhouse-backup-cron
spec:
# every day at 00:00
# schedule: "0 0 * * *"
schedule: "* * * * *"
concurrencyPolicy: "Forbid"
jobTemplate:
@mwaskom
mwaskom / replacing_seaborn_distplot.ipynb
Last active April 16, 2024 13:18
A guide to replacing the deprecated `seaborn.distplot` function.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 16, 2024 13:18
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@vivekkr12
vivekkr12 / BouncyCastleCertificateGenerator.java
Last active April 16, 2024 13:17
Generate root X509Certificate, Sign a Certificate from the root certificate by generating a CSR (Certificate Signing Request) and save the certificates to a keystore using BouncyCastle 1.5x
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.asn1.x509.GeneralName;
import org.bouncycastle.asn1.x509.KeyUsage;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
@darrarski
darrarski / FormattedTextField.swift
Last active April 16, 2024 13:14
SwiftUI FormattedTextField - TextField with custom display/edit formatters
import SwiftUI
public struct FormattedTextField<Formatter: TextFieldFormatter>: View {
public init(_ title: String,
value: Binding<Formatter.Value>,
formatter: Formatter) {
self.title = title
self.value = value
self.formatter = formatter
}
@jamesfreeman959
jamesfreeman959 / keepawake.ps1
Last active April 16, 2024 13:14
A very simple PowerShell script to keep a Windows PC awake and make lync think the user is active on the keyboard
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
$wsh = New-Object -ComObject WScript.Shell
while (1) {
@hitman401
hitman401 / main.rs
Last active April 16, 2024 13:12
Producer Consumer Sample in RUST
use std::sync::{Arc, Mutex, Condvar};
use std::thread;
struct Producer {
cvar: Arc<(Mutex<bool>, Condvar)>
}
impl Producer {
pub fn new(cvar: Arc<(Mutex<bool>, Condvar)>) -> Producer {
Producer {
@piyushgarg-dev
piyushgarg-dev / README.md
Last active April 16, 2024 13:10
Kafka Crash Course