Skip to content

Instantly share code, notes, and snippets.

View dterracino's full-sized avatar
🐢
I may be slow to respond…

David Terracino dterracino

🐢
I may be slow to respond…
View GitHub Profile
@dterracino
dterracino / .gitignore
Created December 5, 2022 06:19 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
// ==UserScript==
// @name Steam Key Quick Activator
// @namespace http://pedrofracassi.me/
// @version 1.2
// @description Activates Steam Keys Quickly!
// @author Pedro Fracassi (http://pedrofracassi.me)
// @match https://store.steampowered.com/account/registerkey?key=*
// @grant none
// @run-at document-end
// ==/UserScript==
@dterracino
dterracino / MOREtrackers.user.js
Created October 13, 2022 19:23 — forked from metinsanli/MOREtrackers.user.js
Adds more trackers for torrent magnet link.
// ==UserScript==
// @name MOREtrackers
// @description:tr Torrent magnet bağlantısına fazladan izleyici ekler.
// @description:az Torrent maqnit bağlantılarına daha çox izləyici əlavə edir.
// @description:en Adds more trackers to torrent magnet links.
// @description:de Fügt mehr Tracker zu Torrent-Magnet-Links hinzu.
// @description:fr Ajoute plus de trackers aux liens magnétiques torrent.
// @description:es Agrega más rastreadores a los enlaces magnéticos de torrent.
// @description:ru Добавляет больше трекеров к магнитным торрент-ссылкам.
// @version 0.5
@dterracino
dterracino / Google Translate - 2022.user.js
Created October 13, 2022 19:19
This script displays a menu option in your userscript manager to translate the current page using Google Translate
// ==UserScript==
// @name Google Translate - 2022
// @namespace https://greasyfork.org/users/906463-coffeegrind123
// @homepageURL https://gist.github.com/coffeegrind123/8ca2c7e700aca3341c71da8d612f6130
// @supportURL https://greasyfork.org/scripts/443947-google-translate-2022
// @include https://*/*
// @include http://*/*
// @exclude http*://*.google.*/*
// @grant GM_registerMenuCommand
// @noframes
public class AsyncLazyPipeline<TSource>
{
private Func<Task<TSource>> Expression { get; }
public AsyncLazyPipeline(Func<Task<TSource>> expression)
{
Expression = expression;
}
public Task<TSource> Flatten() => Expression();
public static partial class LinqExtensions
{
public static Maybe<C> SelectMany<A, B, C>(this Maybe<A> ma, Func<A, Maybe<B>> f, Func<A, B, C> select) => ma.Bind(a => f(a).Map(b => select(a, b)));
}
@dterracino
dterracino / CSharpErrorCodes.cs
Created July 6, 2021 01:49 — forked from thomaslevesque/CSharpErrorCodes.cs
Generate "warnings as errors" ruleset from error code definitions in Roslyn source code
void Main()
{
string errorCodesFileUrl = "https://raw.githubusercontent.com/dotnet/roslyn/master/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs";
string errorCodesFileContent = new WebClient().DownloadString(errorCodesFileUrl);
var syntaxTree = CSharpSyntaxTree.ParseText(errorCodesFileContent);
var root = syntaxTree.GetRoot();
var enumDeclaration =
root.DescendantNodes()
.OfType<EnumDeclarationSyntax>()
.First(e => e.Identifier.ValueText == "ErrorCode");
@dterracino
dterracino / CSharpRecipe.cs
Created June 28, 2021 02:41 — forked from jacobslusser/CSharpRecipe.cs
ScintillaNET C# Automatic Syntax Highlighting
// For an explanation of this code visit:
// https://github.com/jacobslusser/ScintillaNET/wiki/Automatic-Syntax-Highlighting
// Configuring the default style with properties
// we have common to every lexer style saves time.
scintilla.StyleResetDefault();
scintilla.Styles[Style.Default].Font = "Consolas";
scintilla.Styles[Style.Default].Size = 10;
scintilla.StyleClearAll();
@dterracino
dterracino / s3-to-mturk.ipynb
Created May 8, 2021 05:03 — forked from vdavez/s3-to-mturk.ipynb
S3 to Mechanical Turk instructions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dterracino
dterracino / docx2md.md
Created May 8, 2021 05:00 — forked from vdavez/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in Two Moves

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

The Solution

As it turns out, there are several open-source tools that allow for conversion between file types. Pandoc is one of them, and it's powerful. In fact, pandoc's website says "If you need to convert files from one markup format into another, pandoc is your swiss-army knife." But, although pandoc can convert from markdown into .docx, it doesn't work in the other direction.