Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
cellularmitosis / README.md
Last active November 16, 2024 23:20
Factorio robot frame rush blueprint

Factorio robo-rush blueprint (v3)

Here's a mini-base blueprint for rushing to personal roboport.

  • 30 SPM red+green+blue
  • hand-fed 18 SPM black (requires hand-fed walls)
  • Small mall (mostly via overflow chests)

Screen Shot 2024-04-18 at 12 49 52 AM

@molawson
molawson / example.rb
Created December 7, 2023 17:30
Destructuring Ruby objects with pattern matching
class Thing
attr_reader :name, :type
def initialize(name, type)
@name = name
@type = type
end
def deconstruct_keys(_keys)
{ name:, type: }
@d4v3y0rk
d4v3y0rk / howto.md
Created March 14, 2020 13:04
Encryption with DM_CRYPT in WSL2

Encrypted Volumes in WSL2

Description

This is a quick guide on how to setup dm_crypt under WSL2 for working with encrypted volumes. I use an encrypted volume to store things like password recovery codes and 2nd factor backup codes etc. I recently switched over to using WSL2 and wanted to figure out how to enable this functionality there. This is the distilled howto for getting it to work.

Guide

First thing you have to do is create a custom WSL2 kernel. Inside your already installed and running WSL2 (ubuntu) installation:

  • Install some required packages.
@gunn
gunn / frame.tsx
Last active January 21, 2025 19:49
Render react content in an iframe
import * as React from 'react'
import { createPortal } from 'react-dom'
type FrameProps = React.IframeHTMLAttributes<HTMLIFrameElement> & {
head?: React.ComponentType<any>
children?: React.ReactNode
}
const Frame = React.memo(({head, children, ...iframeProps}: FrameProps)=> {
const node = React.useRef<HTMLIFrameElement>()
const [doc, setDoc] = React.useState<Document>()
@erquhart
erquhart / selection-command.js
Last active December 11, 2024 03:28
Text selection commands for Cypress.io
/**
* Credits
* @Bkucera: https://github.com/cypress-io/cypress/issues/2839#issuecomment-447012818
* @Phrogz: https://stackoverflow.com/a/10730777/1556245
*
* Usage
* ```
* // Types "foo" and then selects "fo"
* cy.get('input')
* .type('foo')
@kule
kule / mini_rspec.rb
Created September 11, 2018 09:37
Simplified example of how rspec works
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'colorize'
end
class MatcherInterface
def initialize(some_object)
@some_object = some_object
@tylerhunt
tylerhunt / visualize_specs.rb
Last active February 12, 2018 12:42
Visualize the state of an RSpec suite using the cached example status.
require 'rspec/core'
css = %(
<style>
html { font-size: 50%; }
.unknown, .passed, .pending, .failed { display: inline-block; height: 1rem; width: 1rem; }
.unknown { background-color: #999; }
.pending { background-color: #FC0; }
.passed { background-color: #3F3; }
.failed { background-color: #F33; }
@schmich
schmich / ducky.md
Last active September 24, 2024 08:54
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@tommyettinger
tommyettinger / mulberry32.c
Last active February 24, 2025 16:25
Mulberry32 PRNG
/* Written in 2017 by Tommy Ettinger ([email protected])
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
#include <stdint.h>
@HactarCE
HactarCE / README.md
Last active November 28, 2024 14:11
Factorio blueprint book list

This is just a collection of useful Factorio blueprint books I have either found online or made myself. (Links are included where applicable.) I recommend using this Chrome extension to quickly copy these into Factorio.

All blueprints use blue belts unless stated otherwise.

See also: