Skip to content

Instantly share code, notes, and snippets.

Sven Slootweg joepie91

Block or report user

Report or block joepie91

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joepie91
joepie91 / npm-packages-missing.md
Last active Jan 11, 2018
I can't install a package!
View npm-packages-missing.md

UPDATE: According to npm Inc., the issue has been resolved. This gist will be updated with a link to the post-mortem once it's published. Please make sure to read the below explanation anyway, since there may still be a security impact for you.

UPDATE 2: An initial statement has been released, in which npm Inc. states that there has been no security impact. A full post-mortem is said to be forthcoming, and will be added here when it's published.

UPDATE 3: The full postmortem has been published, including a list of affected packages.


There's currently a known issue affecting the NPM registry, making certain packages impossible to install. You may see an error message indicating that a package doesn't exist, or that the registry is down. More details can be found [here](https

View hydra.md

Just some notes from my attempt at setting up Hydra.

Setting up on NixOS

No need for manual database creation and all that; just ensure that your PostgreSQL service is running (services.postgresql.enable = true;), and then enable the Hydra service (services.hydra.enable). The Hydra service will need a few more options to be set up, below is my configuration for it:

    services.hydra = {
        enable = true;
        port = 3333;
@joepie91
joepie91 / genius-programmer.md
Last active Sep 30, 2019
The One Secret Trick To Becoming A Genius Programmer
View genius-programmer.md

The One Secret Trick To Becoming A Genius Programmer

Okay, the title of this post is a bit of a lie. There's no one secret trick to becoming a genius programmer - there are two, and they're more habits than tricks. Nevertheless, these kind of 'secret tricks' seem to resonate with people, so I went for this title anyway.

Every once in a while, a somewhat strange thing happens to me. I'll be helping somebody out on IRC - usually a beginner - answering a number of their questions in rapid succession, about a variety of topics. Then after a while, they call me a "genius" for being able to answer everything they're asking; either directly, or while talking about me to somebody else.

Now, I don't really agree with this "genius" characterization, and it can make me feel a bit awkward, but it shows that a lot of developers have a somewhat idealistic and nebulous notion of the "genius programmer" - the programmer that knows everything, who can do everything, who's never stumped by a problem, and of which ther

View futures-tokio.md

(This Gist is a work-in-progress, and things may be added or changed over time.)

Event loops

If you're not familiar with the concept of an 'event loop' yet, watch this video first. While this video is about the event loop in JavaScript, most of the concepts apply to event loops in general, and watching it will help you understand Tokio and Futures better as well.

Concepts

  • Futures: Think of a Future like an asynchronous Result; it represents some sort of result (a value or an error) that will eventually exist, but doesn't yet. It has many of the same combinators as a Result does, the difference being that they are executed at a later point in time, not immediately. Aside from representing a future result, a Future also contains the logic that is necessary to obtain it. A Future will 'complete' (either successfully or with an error) precisely once.
  • Streams: Think of a [Stream](https
@joepie91
joepie91 / .md
Last active Nov 30, 2017
About the Ayo fork of Node.js
View .md

This is a brief post to answer some of the common questions about Ayo (a fork of Node.js), to cut down on the noise in #Node.js. Keep in mind that I'm in no way associated with Ayo, this is just an attempt to cover some of the frequent questions.

Important note: Be aware that discussion about the political reasons behind the Ayo fork is considered off-topic in the #Node.js channel, as that channel is primarily intended for technical support, and this is a topic that is very likely to invite trolling and polarization.

If you wish to discuss the politics behind the fork, there are plenty of comment threads around the web on the usual sites; Hacker News, Reddit, and so on. Please direct your discussion there instead.

Discussions in #Node.js about the technical aspects of the Ayo fork (eg. compatibility) are, of course, fine.

Why was Ayo forked?

@joepie91
joepie91 / nixos-sysinfo.sh
Created Aug 18, 2017
Bash function for printing system information for nixpkgs issues
View nixos-sysinfo.sh
function nixos-sysinfo {
echo "* System: $(nixos-version)"
echo "* Nix version: $(nix-env --version)"
echo "* Nixpkgs version: $(nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion)"
echo "* Sandboxing enabled: $(grep build-use-sandbox /etc/nix/nix.conf | grep -oE 'true|false')"
}
@joepie91
joepie91 / .md
Last active Sep 4, 2019
Prefix codes (explained simply)
View .md

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

@joepie91
joepie91 / .md
Last active Mar 20, 2019
Useful tools for working with NixOS
@joepie91
joepie91 / packages.nix
Last active Oct 12, 2018
Mozilla Rust overlay in environment.systemPackages
View packages.nix
options: let
combinedOptions = options // {
overlays = [
(import ../nixpkgs-mozilla/rust-overlay.nix)
];
};
in {
master = (import (fetchTarball https://github.com/NixOS/nixpkgs/archive/master.tar.gz) combinedOptions);
unstable = (import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz) combinedOptions);
nixpkgs = (import <nixpkgs>) combinedOptions;
View drawchart.js
const ChartjsNode = require('chartjs-node');
// 600x600 canvas size
var chartNode = new ChartjsNode(600, 600);
var randomnumber=Math.random();
var imagename = "testimage"+randomnumber+".png"
module.exports = imagename
// each api returns a Promise
chartNode.drawChart({
type: 'bar',
You can’t perform that action at this time.