This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First, load jQuery: | |
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
//////////////////////////////////////////////////////////////////////////// | |
// Remove all disliked songs: | |
for (const el of $('ytmusic-responsive-list-item-renderer:has([like-status="DISLIKE"])').get()) { | |
el.dispatchEvent(new MouseEvent('contextmenu')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run this in LINQPad, and add a reference to my https://github.com/ShomreiTorah/Libraries/tree/master/ShomreiTorah.Common | |
const string domain = "<TODO: insert domain here>"; | |
static readonly Regex parseId = new Regex(@"action=edit_addresses&id=(\d+)"); | |
static readonly Regex findSccsrf = new Regex(@"<input type=""hidden"" name=""sccsrf"" value=""(\w+)""/>"); | |
bool dryRun = false; | |
async Task Main() { | |
var cookies = new CookieContainer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
copy(await (async () => { | |
var lastId = localStorage.SLaks___lastExportedId || /* Paste the last ID from the spreadsheet here: */ ""; | |
function takeWhile(cb) { | |
let found = false; | |
return x => { | |
if (found) return false; | |
if (cb(x)) return true; | |
found = true; | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using Autofac; | |
using Autofac.Core; | |
using NLog; | |
using log4net; | |
using LogManager = NLog.LogManager; | |
namespace AutofacIdea | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Web.Mvc; | |
namespace ExcelExporter.Mvc { | |
///<summary>An ActionResult that sends an Excel spreadsheet to the client.</summary> | |
public class ExcelResult : FilePathResult { | |
static readonly Dictionary<ExcelFormat, string> ContentTypes = new Dictionary<ExcelFormat, string> { | |
{ ExcelFormat.Excel2003, "application/vnd.ms-excel" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main() | |
{ | |
Console.WriteLine(X<int>.GetValue()); | |
Console.WriteLine(X<long>.GetValue()); | |
} | |
static class X<T> { | |
static int IntValue = 42; | |
static long LongValue = 64; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class X | |
{ | |
void M<T>() { var x = (M<T>) < new X(); } | |
public static int operator <(Action a, X x) { return 0; } | |
public static int operator >(Action a, X x) { return 0; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://projecteuler.net/problem=14 | |
Enumerable.Range(1, 1000000).Select(s => | |
Enumerable.Repeat(new List<long>(32) { s }, 1) | |
.First(list => | |
Enumerable.Range(0, Int32.MaxValue) | |
.TakeWhile(i => list.Last() > 1) | |
.Aggregate(0, (index, unused) => { | |
list.Add(list.Last() % 2 == 0 ? list.Last() / 2 : 3 * list.Last() + 1); | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//const string OriginalPath = @"C:\Users\SSL\Development\RefSrc\Source"; | |
const string PDBPath = @"C:\Users\SSL\Development\Symbols\RefSrc\Symbols"; | |
const string OriginalPath = @"C:\Users\SSL\Development\Symbols\RefSrc\Source\.NET 4.5\4.6.0.0"; | |
const string TargetPath = @"C:\Users\SSL\Development\3rd-Party Source\Microsoft\.Net 4.5.1"; | |
const string ErrorLog = TargetPath + @"\Errors.log"; | |
static readonly Regex GoodLine = new Regex(@"^[a-zA-Z0-9\\:]{5}"); | |
void Main() { | |
var pdbs = from file in Directory.EnumerateFiles(PDBPath, "*.pdb", SearchOption.AllDirectories) | |
group file by Path.GetFileName(file) into g | |
select g.OrderByDescending(p => new FileInfo(p).Length).First(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using Microsoft.Internal.VisualStudio.PlatformUI; | |
using Microsoft.Internal.VisualStudio.Shell.Interop; | |
using Microsoft.VisualStudio; | |
using Microsoft.VisualStudio.Platform.WindowManagement; | |
using Microsoft.VisualStudio.PlatformUI; | |
using Microsoft.VisualStudio.Shell; |
NewerOlder