Skip to content

Instantly share code, notes, and snippets.

@ErgEnn
ErgEnn / belief.user.js
Last active February 6, 2024 12:03
Belief.user.js
// ==UserScript==
// @name Belief
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Maasika maitseline
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
@ErgEnn
ErgEnn / gym.http
Last active January 30, 2024 12:33
Gym
POST https://goapi2.perfectgym.com/v1/Authorize/LogInWithEmail
content-type: application/json
{
"email": "",
"password": "",
"clientApplicationInfo": {
"type": "WhiteLabel",
"whiteLabelId": "57F56624-35D7-4CD6-9863-24FC974673B8"
}
@ErgEnn
ErgEnn / FBMarketplaceHider.user.js
Created October 22, 2023 12:56
Facebook Marketplace item hider
// ==UserScript==
// @name Facebook Marketplace Item Hider
// @namespace FBMarkerplaceHider
// @match *://www.facebook.com/marketplace/*
// @grant GM_setValue
// @grant GM_getValue
// @version 1.0
// @author Ergo Enn
// @description On right-click allows to hide item in Facebook Marketplace
// @downloadURL https://gist.github.com/ErgEnn/
@ErgEnn
ErgEnn / mcp23008.ino
Created October 13, 2023 12:39
MCP23008 test code
#include <Adafruit_MCP23X08.h>
Adafruit_MCP23X08 mcp;
Adafruit_MCP23X08 mcp2;
void setup() {
Serial.begin(115200);
mcp.begin_I2C(0x20);
mcp2.begin_I2C(0x24);
@ErgEnn
ErgEnn / DisposeExample.cs
Created October 9, 2023 09:30
[C# error handling]
internal class Disp : IDisposable
{
public void Dispose()
{
Console.WriteLine("dispose"); //<----- called
}
}
static void Main(string[] args)
{
try
@ErgEnn
ErgEnn / readme.md
Last active September 12, 2023 12:42
yq cheatsheet for csv

Open query output in vscode

yq -p=csv -o=csv sample.csv | code -

Example csv

foo,bar,baz
abc,1,-1
def,2,-2
@ErgEnn
ErgEnn / Address.cs
Last active July 14, 2023 10:05
[Resharper CodeTemplateAttribute example for renaming] Example of how to use [CodeTemplate] annotation to make renaming easier when you can't directly rename occurances. E.g the renaming happened in Nuget package and needs to be shown to user at later time when they update to version with renamed property
using System;
using JetBrains.Annotations;
namespace Database
{
public class Address
{
[CodeTemplate(
searchTemplate:"$member$",
Message = "Renamed to "+nameof(Longitude),
@ErgEnn
ErgEnn / autofill_bookmarklet.js
Last active June 7, 2023 07:52
Autofill bookmarklet. Make a bookmark with given JS as URL. Clicking on it will fill focused textbox (i.e. Swagger Authorize) with value specified specified in `e.value="THIS TEXT WILL BE INSERTED"'` quotes.
javascript:(function(){var e=document.activeElement,t="THIS TEXT WILL BE INSERTED";Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))})();
@ErgEnn
ErgEnn / delete_worktree.ps1
Last active August 14, 2023 14:14
Powershell scripts to manage per ticket worktrees of multiple repos
try {
$ticketNumber = Read-Host "Enter ticket number to delete"
Get-ChildItem -Filter *.git |
ForEach-Object {
$gitPath = $_.FullName
$gitName = $_.Name.Replace(".git", "")
& git --git-dir=$gitPath worktree remove "tickets/$ticketNumber/$gitName" --force
& git --git-dir=$gitPath branch -d $ticketNumber
}
@ErgEnn
ErgEnn / ColorizeCloudwatch.user.js
Last active March 28, 2023 08:43
Colorizes CloudWatch log insights
// ==UserScript==
// @name ColorizeCloudwatch
// @namespace ColorizeCloudwatch
// @version 0.2
// @description Colorize CloudWatch log insight rows based on request ID
// @author Ergo Enn
// @match https://*.console.aws.amazon.com/cloudwatch/*
// @icon https://s3.amazonaws.com/cloudwatch-console-static-content-s3/1.0/images/cloudwatch-favicon.ico
// @downloadURL https://gist.github.com/ErgEnn/b3d49e15182e391d03b3464248a82f63
// @updateURL https://gist.github.com/ErgEnn/b3d49e15182e391d03b3464248a82f63