https://keyoxide.org/9EEDA1912E63EA6957C5E5BAECED8D5E12FA2A5F
๐
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
#!/usr/bin/env python3 | |
""" | |
Send Webmentions for Hacker News stories and comments. | |
Webmention: https://www.w3.org/TR/webmention/ | |
Dependencies: | |
- python3 -m pip install indieweb_utils BeautifulSoup4 | |
""" | |
import requests | |
import indieweb_utils |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
/* | |
* This code is only used for loading/saving preferences | |
* to/from `localstorage`. If scripts are disabled all | |
* the theming still works, they just won't persist. :^) | |
*/ |
I hereby claim:
- I am sidneys1 on github.
- I am sidneys1 (https://keybase.io/sidneys1) on keybase.
- I have a public key ASBmGWIlLw6-LD8Fi58TLJ6mP0tFZm-lZO8iEpacavmfnwo
To claim this, I am signing this object:
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
find . -type f -links +1 -printf '%i %s\n' | # Find all files with more than one link (hardlinks), and print the inode and size | |
sort | uniq -c | # Sort and unique, prefixing the number of repeated lines. | |
# Since all hardlinks point to the same inode, the count will be the number of | |
# files pointing to each unique inode. | |
awk '{print ($1-1)*$3}' | # Multiply the first number minus one (redundant hardlinks) by the second number (size). | |
awk '{n+=$1}; END{print n}' | # Sum the results. | |
numfmt --to=iec-i # Convert to an IEC i-size. |
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
#!/usr/bin/env bash | |
HELP="Usage: $0 [-n LINES] [-p PREFIX] [-w] [-h] | |
Continuously displays the last '-n' lines of 'stdin'. | |
Parameters: | |
-n Number of lines to display (default: 5). | |
-p PREFIX Prefix lines with 'PREFIX'. | |
-w Preserve blank lines (default: false). | |
-h Display this help |
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
"""Helper for json-based objects""" | |
from inspect import isclass | |
from typing import get_type_hints, Union, TypeVar, Type | |
# cSpell:ignore isclass | |
def patch_target(target, patch): | |
if not isinstance(patch, dict): |
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
internal static class InterruptableReadline { | |
private static readonly AutoResetEvent StartReading = new AutoResetEvent(false); | |
private static readonly AutoResetEvent DoneReading = new AutoResetEvent(false); | |
private static readonly Thread ReadThread = new Thread(ReadThreadMain) { IsBackground = true }; | |
private static string _readVal; | |
private static bool _cancelled; | |
static InterruptableReadline() { ReadThread.Start(); } | |
public static void Shutdown() { ReadThread.Abort(); } |
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.Reflection; | |
using System.Runtime.CompilerServices; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
namespace StaticInterfaceTest { | |
public interface IInterface { | |
int Run(); | |
} |
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.Linq; | |
namespace SumIt { | |
internal static class Program { | |
private static void Main() { | |
var nums = new List<string[]> { new[] { "+-1", "+1" } }; | |
for (var i = 2; i < 10; i++) |
NewerOlder