Skip to content

Instantly share code, notes, and snippets.

using OfficeOpenXml;
using OfficeOpenXml.Style;
using System.Drawing;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
// Source code is licensed under MIT 2023 Joseph Lennox
// scryfall does not appear to post a license for their data.
@jlennox
jlennox / no_bad_python_sites.goggle
Last active June 28, 2022 17:32
No geeksforgeeks and w3schools
! name: No geeksforgeeks and w3schools
! description: Removes geeksforgeeks.org and w3schools.com from search results and boosts official documentation sites.
! public: true
! author: jlennox
! avatar: #03de20
$discard,site=www.geeksforgeeks.org
$discard,site=www.w3schools.com
$discard,site=geeksforgeeks.org
$discard,site=w3schools.com
@jlennox
jlennox / Hulu url search.js
Created April 20, 2022 22:59
Add seach to Hulu's url using tampermonkey
// ==UserScript==
// @name Add URL search to hulu
// @namespace http://tampermonkey.net/
// @version 0.1
// @match https://www.hulu.com/search?q=*
// @grant none
// ==/UserScript==
function performSearch()
{
@jlennox
jlennox / avr-bit-twiddle.md
Last active June 2, 2021 17:37
Bit twiddling PORT optimizations on AVR 1/0 series (attiny, atmega)
  • PORTB.DIR |= 0b010 is 5 instructions.
  • PORTB.DIRSET = 0b010 is 2 instructions, one of which is double width (2 tick?).
  • VPORTB.DIR |= 0b010 is optimized by the compiler to 1 instruction.

The magic sauce is that VPORTB is mapped to 0x0000 (PORTB is mapped to 0x0400), the chips have instructions to bit twiddle in a single instruction but only on addresses 0x00 to 0x1F. The higher mapping has extra costs on an 8bit CPU.

// PORTB.DIR |= PIN3_bm;
80a:	e0 e2 ldi	r30, 0x20	; 32
@jlennox
jlennox / cuMemcpy2d_trace.cpp
Last active January 7, 2020 19:51
cuMemcpy2d_trace.cpp
#include <stdio.h>
#include "pin.H"
static FILE *g_trace;
static BOOL g_enabled;
static ADDRINT g_startAddr;
static ADDRINT g_endAddrLow;
static ADDRINT g_endAddrHeight;
static ADDRINT g_ret;
@jlennox
jlennox / gist:60318af13c22a028fc98779191aba4e6
Last active June 18, 2018 15:06
List of framework structs in .NET that are now readonly with C# 7.2
ArraySegment<T>
CancellationToken
CancellationTokenRegistration
ConfiguredTaskAwaitable
ConfiguredTaskAwaitable<TResult>
ConfiguredTaskAwaiter
ConfiguredValueTaskAwaitable
ConfiguredValueTaskAwaitable<TResult>
ConfiguredValueTaskAwaiter
DateTime
@jlennox
jlennox / gist:3639901543c1347ed221484535cd6f4b
Last active February 14, 2018 22:22
Appium issue 10126 appium logs
2018-02-14 12:47:46.2934 Appium starting for sessionId 8bad89c2-a96f-46aa-aad8-9088637be688
2018-02-14 12:47:48.3921 [Appium] Welcome to Appium v1.7.1
2018-02-14 12:47:48.3929 [Appium] Non-default server args:
2018-02-14 12:47:48.3929 [Appium] address: 127.0.0.1
2018-02-14 12:47:48.3929 [Appium] port: 23012
2018-02-14 12:47:48.3929 [Appium] bootstrapPort: 23014
2018-02-14 12:47:48.3929 [Appium] chromeDriverPort: 23013
2018-02-14 12:47:48.3929 [Appium] chromedriverExecutable: chromedriver-2.34
2018-02-14 12:47:48.3929 [Appium] tmpDir: /tmp/appium-instance
2018-02-14 12:47:48.3929 [Appium] suppressKillServer: true
This file has been truncated, but you can view the full file.
[2018-02-14 12:37:47.3898] 02-14 12:37:47.389 W/BroadcastQueue( 766): Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.google.android.apps.plus flg=0x4000010 (has extras) } to com.google.android.ims/.receivers.RcsAutoStartReceiver
[2018-02-14 12:37:47.3980] 02-14 12:37:47.399 I/zygote64(24991): Deoptimizing void com.android.launcher3.DeferredHandler$Impl.handleMessage(android.os.Message) due to JIT inline cache
[2018-02-14 12:37:47.4049] 02-14 12:37:47.411 I/ActivityManager( 766): Start proc 14356:com.google.android.apps.plus/u0a95 for broadcast com.google.android.apps.plus/com.google.android.libraries.social.jobscheduler.JobSchedulerOnPackageUpgrade
[2018-02-14 12:37:47.5254] 02-14 12:37:47.529 I/Icing (31468): IndexChimeraService.getServiceInterface callingPackage=com.google.android.gms componentName=AppsCorpus serviceId=32
[2018-02-14 12:37:47.5265] 02-14 12:37:47.532 I/Icing (31468): IndexChimeraService.getServiceInterface callingPackage
sudo rm -r /Applications/Calculator.app
sudo rm -r /Applications/Calendar.app
sudo rm -r /Applications/Contacts.app
sudo rm -r /Applications/Chess.app
sudo rm -r /Applications/Dashboard.app
sudo rm -r /Applications/FaceTime.app
sudo rm -r /Applications/Font\ Book.app
sudo rm -r /Applications/DVD\ Player.app
sudo rm -r /Applications/Dictionary.app
sudo rm -r /Applications/iBooks.app
Task AnarcodesWebClientLoop(string[] urls) {
using (var entryGate = new SemaphoreSlim(10, 10)) {
var requests = urls.Select(async url => {
await entryGate.WaitAsync();
var didError = false;
string errorMessage = null;
try {
var req = WebRequest.Create(url);
using (var res = (HttpWebResponse)await req.GetResponseAsync())