Skip to content

Instantly share code, notes, and snippets.

@AndrasKovacs
AndrasKovacs / OneBRC.hs
Last active April 30, 2024 18:49
1brc
{-# language
BlockArguments
, CPP
, LambdaCase
, MagicHash
, PatternSynonyms
, Strict
, TypeApplications
@voidptr
voidptr / .bashrc
Last active April 30, 2024 18:48
Execute Fish Shell from Bash at end of .bashrc -- while being able to invoke Bash shell from fish without re-running Fish -- and without having to use --norc
# Many systems, such as Arch, MSys2, Cygwin, etc., need to have Bash interpret
# their startup scripts, set Environment variables, etc. Therefore, setting your
# default shell to anything other than Bash might not be a good idea. In these
# cases, the conventional advice is to append 'exec fish' at the end of your
# .bashrc. However, this approach creates another problem; should you need to
# drop into Bash to run a bash script, you need to be careful to use
# 'bash --norc' every time. Otherwise, Fish will start up again when you don't
# want it to. Obviously, this is cumbersome and inefficient. Thus, instead of
# doing a naked 'exec fish' at the end of your .bashrc, use the following:
@oaluna
oaluna / index.html
Created December 8, 2020 18:43
Stripe Website Gradient Animation
<html>
<head>
<title>Stripe Gradient</title>
</head>
<body>
<canvas id="gradient-canvas" data-js-darken-top data-transition-in>
<!--
Remove data-js-darken-top to keep the same brightness in the upper part of the canvas
-->
</canvas>
@ultim8k
ultim8k / vim-multiline-comment.md
Last active April 30, 2024 18:46
(un) comment multiple lines vim

From: http://stackoverflow.com/questions/1676632/whats-a-quick-way-to-comment-uncomment-lines-in-vim

For those tasks I use most of the time block selection.

Put your cursor on the first # character, press Ctrl``V (or Ctrl``Q for gVim), and go down until the last commented line and press x, that will delete all the # characters vertically.

For commenting a block of text is almost the same: First, go to the first line you want to comment, press Ctrl``V, and select until the last line. Second, press Shift``I``#``Esc (then give it a second), and it will insert a # character on all selected lines. For the stripped-down version of vim shipped with debian/ubuntu by default, type : s/^/# in the second step instead.

@vshabanov
vshabanov / OneBRC.hs
Last active April 30, 2024 18:46
One billion lines challenge
{-# LANGUAGE GHC2021, LambdaCase, PatternSynonyms, RecordWildCards,
ViewPatterns, OverloadedStrings, GADTs, NoMonoLocalBinds,
UnboxedTuples, MagicHash #-}
{-# OPTIONS_GHC -O2 -fspec-constr-count=100 -fllvm #-}
-- need at least 8 to completely remove all allocations
-- (I don't know what change lead to it)
{-# OPTIONS_GHC -Wall -Wno-gadt-mono-local-binds -Wno-type-defaults #-}
@ashee
ashee / mac-oui.text
Last active April 30, 2024 18:42
Common mac address prefix/oui
QEMU - 52:54:00
VMWare - 00:50:56
Xen Source - 00:16:3E
Xen - 00:ca:fe
Microsoft - 00:15:5D
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Z-Index Example</title>
<style>
html, body { background-color: #00787F; }
.container {
position: relative;
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
function getAbout(json) {
const aboutComponent = json?.included?.find((d) =>
d.entityUrn?.includes("ABOUT")
);
return aboutComponent?.topComponents?.[1]?.components?.textComponent?.text
?.text;
}
function getExperience(json) {
const experienceEntity = json?.included?.find(
@tresorama
tresorama / dynamic-data.text.tsx
Created August 25, 2023 08:10
wordpress-gutenberg--POC--dynamic-data
import { createHigherOrderComponent } from '@wordpress/compose';
import * as wpHooks from '@wordpress/hooks';
import { BlockControls, InspectorControls } from '@wordpress/block-editor';
import { PanelBody, PanelRow } from '@wordpress/components';
import { Icon, backup as backupIcon } from '@wordpress/icons';
import { Post, useEntityRecord } from '@wordpress/core-data';
import { store as coreStore } from '@wordpress/core-data';
import { useSelect, useDispatch } from '@wordpress/data';
import { BlockEditProps } from '@wordpress/blocks';