Skip to content

Instantly share code, notes, and snippets.

@hayleyxyz
hayleyxyz / usb-swap.service
Created July 8, 2019 20:58
systemd service to automatically toggle swapon when a certain usb drive is installed
[Unit]
Description=Flash drive swapon
Requires=dev-disk-by\x2duuid-7849984a\x2de42f\x2d497a\x2dafec\x2d8bebb8384f7a.device
After=dev-disk-by\x2duuid-7849984a\x2de42f\x2d497a\x2dafec\x2d8bebb8384f7a.device
[Service]
ExecStart=/sbin/swapon -U 7849984a-e42f-497a-afec-8bebb8384f7a
[Install]
WantedBy=dev-disk-by\x2duuid-7849984a\x2de42f\x2d497a\x2dafec\x2d8bebb8384f7a.device
@hayleyxyz
hayleyxyz / ida64.reg
Last active May 19, 2024 22:24
Add "Open with IDA Pro (64-bit)" menu item
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\dllfile\shell\Open with IDA Pro]
"Icon"="\"C:\\Program Files\\IDA Pro 8.3\\ida64.exe\",0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\dllfile\shell\Open with IDA Pro\Command]
@="C:\\Program Files\\IDA Pro 8.3\\ida64.exe \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\exefile\shell\Open with IDA Pro]
"Icon"="\"C:\\Program Files\\IDA Pro 8.3\\ida64.exe\",0"
/* You have a set of scales which are unbalanced and the aim is to use a maximum of two of the remaining weights to see if you can balance the scales. If you do need to use 2 weights they can be placed on the same scale.
Write a function that can accept 3 arguments. The first argument will be an integer greater than 0 that represents the current weight of the left scale, the second argument will be an integer greater than 0 that represents the weight of the right scale and the last argument will be an array of positive integers that represent the weights you currently have remaining to use.
For example (5, 9, [3,5,8,12]). 5 represents the left scale’s current weight. 9 represents the right scale’s current weight and the array represents the weights you have at your disposal.
If you can balance the scales then the function should return an array of the number(s) required to make the scales balance. Otherwise it can return nil/null.
Examples
input (6, 8, [3, 4, 5, 8])
const x = (strings, ...params) => {
let arr = '';
for(let i = 0; i < params.length; i++) {
arr += (strings[i]);
arr += (params[i]);
}
arr += (strings[params.length]);
// ==UserScript==
// @name Discord - Hide blocked messages
// @version 1
// @grant none
// @match https://discordapp.com/*
// @run-at document-start
// ==/UserScript==
(() => {
const callback = (mutationsList, observer) => {
const getEventNames = (root) => {
let events = [ ];
const objectHasSubPrototype = (object, comp) => {
let proto = Object.getPrototypeOf(object);
while(proto !== null && proto !== EventTarget) {
proto = Object.getPrototypeOf(proto);
}
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\exefile\shell\Open with ILSpy]
"Icon"="\"C:\\Users\\hayley\\Projects\\ILSpy\\ILSpy\\bin\\Release\\net6.0-windows\\ILSpy.exe\",0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\exefile\shell\Open with ILSpy\Command]
@="\"C:\\Users\\hayley\\Projects\\ILSpy\\ILSpy\\bin\\Release\\net6.0-windows\\ILSpy.exe\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\dllfile\shell\Open with ILSpy]
"Icon"="\"C:\\Users\\hayley\\Projects\\ILSpy\\ILSpy\\bin\\Release\\net6.0-windows\\ILSpy.exe\",0"
@hayleyxyz
hayleyxyz / Debouncer.cs
Last active July 26, 2020 20:41 — forked from pmunin/Debouncer.cs
Action Debouncer for C#
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Timers;
using System.Threading;
using System.Windows.Threading;
/// <summary>
/// Event debouncer helps to prevent calling the same event handler too often (like mark Dirty or Invalidate)
// ==UserScript==
// @name GitHub "Earliest Commit"
// @version 1
// @grant none
// @match https://github.com/*
// ==/UserScript==
const exec = () => {
const exists = (...sel) => {
return sel.every((s) => document.querySelectorAll(s).length > 0);
// ==UserScript==
// @name Twitch - Big emotes
// @version 1
// @grant none
// @match https://www.twitch.tv/*
// @run-at document-start
// ==/UserScript==
//