Skip to content

Instantly share code, notes, and snippets.

View Destitute-Streetdwelling-Guttersnipe's full-sized avatar
🎯
Focusing

DSG (Destitute Streetdwelling Guttersnipe) Destitute-Streetdwelling-Guttersnipe

🎯
Focusing
View GitHub Profile
@joepie91
joepie91 / blockchain.md
Last active July 9, 2026 08:27
Is my blockchain a blockchain?

Your blockchain must have all of the following properties:

  • It's a merkle tree, or a construct with equivalent properties.
  • There is no single point of trust or authority; nodes are operated by different parties.
  • Multiple 'forks' of the blockchain may exist - that is, nodes may disagree on what the full sequence of blocks looks like.
  • In the case of such a fork, there must exist a deterministic consensus algorithm of some sort to decide what the "real" blockchain looks like (ie. which fork is "correct").
  • The consensus algorithm must be executable with only the information contained in the blockchain (or its forks), and no external input (eg. no decisionmaking from a centralized 'trust node').

If your blockchain is missing any of the above properties, it is not a blockchain, it is just a ledger.

@nobitagamer
nobitagamer / azurepc
Last active October 26, 2023 09:44
:: Setup default environment for developers
:: - Version: 1.2
:: How to use:
:: - Run from cmd: START http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/nobitagamer/a985aeee3409a1a846c7deab5e60d933/raw/
:: - From IE: http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/nobitagamer/a985aeee3409a1a846c7deab5e60d933/raw/
Set-ExplorerOptions -showHidenFilesFoldersDrivers -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst WindowsInstaller31 -source webpi
@joepie91
joepie91 / .md
Last active June 25, 2023 08:52

In response to http://quirksmode.org/presentations/Spring2017/goingwrong_vanlanschot.pdf:

  • "Native apps communicate directly with the OS. Web apps communicate with the browser, which communicates with the OS. Therefore web apps will always be a bit slower and coarser than native apps."
    • False -- there is nothing that requires this from a technical perspective. See eg. FirefoxOS and ChromeOS for an example of making the browser layer be the OS layer. Entirely implementation-dependent.
    • Misleading, too -- this can be said for literally every type of runtime, including commonly used ones like those for Python (which many of your desktop applications likely use!), Ruby, Go, the JVM, and so on. Browsers are not special in this regard.
  • "It will have caught up with native in ... I don’t know, two years? But by that time native will also have progressed and we’ll still be behind."
    • False for pretty much the same reasons. Completely possible to achieve performance that is on-par with current-day deskt
@joepie91
joepie91 / .md
Created March 25, 2017 22:51
Database characteristics

NOTE: This is simplified. However, it's a useful high-level model for determining what kind of database you need for your project.

Data models

  • Documents: Single type of thing, no relations
  • Relational: Multiple types of things, relations between different types of things
  • Graph: Single or multiple types of things, relations between different things of the same type

Consistency models

@joepie91
joepie91 / .md
Created March 27, 2017 21:03
Asking questions respectfully

Every once in a while, somebody comes into an IRC channel with a code question, and their code turns out to be a mess - very hard to understand, even harder to fix, and sometimes flat-out unfixable. This is usually followed by a recommendation towards the person asking the question, suggesting that they clean up the code first, and giving them concrete suggestions on how to do so.

Most of the time, this works fine - the asker cleans up the code and returns with a more readable version. Unfortunately, sometimes it does not.

The problem

Asking people on IRC a question means asking volunteers to give up their time and energy to solve your problem. This is fine, since that's what people are there to do in the first place - however, it means that you are expected to put in your part of the effort as well.

When you respond with something along the lines of:

@jaredcatkinson
jaredcatkinson / Get-InjectedThread.ps1
Last active March 13, 2026 04:24
Code from "Taking Hunting to the Next Level: Hunting in Memory" presentation at SANS Threat Hunting Summit 2017 by Jared Atkinson and Joe Desimone
function Get-InjectedThread
{
<#
.SYNOPSIS
Looks for threads that were created as a result of code injection.
.DESCRIPTION
@joepie91
joepie91 / .md
Last active June 25, 2023 08:52

A few notes on the "Gathering weak npm credentials" article

Yesterday, an article was released that describes how one person could obtain access to enough packages on npm to affect 52% of the package installations in the Node.js ecosystem. Unfortunately, this has brought about some comments from readers that completely miss the mark, and that draw away attention from the real issue behind all this.

To be very clear: This (security) issue was caused by 1) poor password management on the side of developers, 2) handing out unnecessary publish access to packages, and most of all 3) poor security on the side of the npm registry.

With that being said, let's address some of the common claims. This is going to be slightly ranty, because to be honest I'm rather disappointed that otherwise competent infosec people distract from the underlying causes like this. All that's going to do is prevent this from getting fixed in other l

@joepie91
joepie91 / .md
Last active November 19, 2025 11:48
A *complete* listing of operators in Nix, and their predence.

Lower precedence means a stronger binding; ie. this list is sorted from strongest to weakest binding, and in the case of equal precedence between two operators, the associativity decides the binding.

Prec Abbreviation Example Assoc Description
1 SELECT e . attrpath [or def] none Select attribute denoted by the attribute path attrpath from set e. (An attribute path is a dot-separated list of attribute names.) If the attribute doesn’t exist, return default if provided, otherwise abort evaluation.
2 APP e1 e2 left Call function e1 with argument e2.
3 NEG -e none Numeric negation.
4 HAS_ATTR e ? attrpath none Test whether set e contains the attribute denoted by attrpath; return true or false.
5 CONCAT e1 ++ e2 right List concatenation.
6 MUL e1 * e2 le
@joepie91
joepie91 / .md
Last active June 25, 2023 08:51
Useful tools for working with NixOS
@joepie91
joepie91 / .md
Last active March 30, 2026 05:57
Prefix codes (explained simply)

A "prefix code" is a type of encoding mechanism ("code"). For something to be a prefix code, the entire set of possible encoded values ("codewords") must not contain any values that start with any other value in the set.

For example: [3, 11, 22] is a prefix code, because none of the values start with ("have a prefix of") any of the other values. However, [1, 12, 33] is not a prefix code, because one of the values (12) starts with another of the values (1).

Prefix codes are useful because, if you have a complete and accurate sequence of values, you can pick out each value without needing to know where one value starts and ends.

For example, let's say we have the following codewords: [1, 2, 33, 34, 50, 61]. And let's say that the sequence of numbers we've received looks like this:

1611333425012