Skip to content

Instantly share code, notes, and snippets.

Avatar

Ian Channing ianchanning

View GitHub Profile
View history.txt
I was drawn to programming, science, technology and science fiction
ever since I was a little kid. I can't say it's because I wanted to
make the world a better place. Not really. I was simply drawn to it
because I was drawn to it. Writing programs was fun. Figuring out how
nature works was fascinating. Science fiction felt like a grand
adventure.
Then I started a software company and poured every ounce of energy
into it. It failed. That hurt, but that part is ok. I made a lot of
mistakes and learned from them. This experience made me much, much
@skeeto
skeeto / sandpiles.c
Created Apr 25, 2020
Sandpiles idenity calculator using AVX2 SIMD
View sandpiles.c
/* Sandpiles identity compute and render
* Many piles are processed in parallel using AVX2 and OpenMP.
*
* $ cc -O3 -march=native -fopenmp sandpiles.c
* $ ./a.out >identity.ppm
*
* $ cc -O3 -march=native -DANIMATE -DN=64 -DSCALE=16 sandpiles.c
* $ ./a.out | mpv --no-correct-pts --fps=20 -
*
* Ref: https://www.youtube.com/watch?v=1MtEUErz7Gg
@premek
premek / mv.sh
Last active Apr 17, 2021
Rename files in linux / bash using mv command without typing the full name two times
View mv.sh
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
View zettelkasten-search.rb
require "sqlite3"
require 'set'
require 'byebug'
# Will be rebuilt at any time. Nice and incremental.
db = SQLite3::Database.new "index.db"
# Keep prefix indexes for "mos*" searches.
#
# TODO: It doesn't seem like SQLITE FTS5 supports synonyms well. That's ok, but
# we're going to want that. We can download this database from Princeton, write
@stratosgear
stratosgear / paypal_experience.md
Last active Jul 29, 2019
Ask HN: Is this Paypal experience customary?
View paypal_experience.md

Here is a succinct timeline of the events.

  • I received a Paypal notification that 600 USD were deposited on my account.
  • I was not expecting any money, so I logged in to see what this is about.
  • Apparently someone paid me for an item they bought on Ebay.
  • The information contained on my Paypal account about the transaction, did NOT contain any information on what this is about.
  • I am NOT an Ebay seller, so I have nothing else to follow this up.
  • My first thought (apart from quickly spending the money) was that some poor soul after thinking that they have paid for an item they would wait for ever for an item they thought they purchased, only to never receive it.
  • So I spent some considerable amount of time trying to locate the seller from their name only (did not have an email) by googling around, to clarify the issue
  • As it was getting late, I left the issue to continue the next day.
@wybiral
wybiral / noscript-tracking.go
Last active Apr 12, 2021
Tracking cursor position in real-time with remote monitoring (without JavaScript)
View noscript-tracking.go
// Tracking cursor position in real-time without JavaScript
// Demo: https://twitter.com/davywtf/status/1124146339259002881
package main
import (
"fmt"
"net/http"
"strings"
)
@andywer
andywer / _readme.md
Last active May 10, 2021
React - Functional error boundaries
View _readme.md

React - Functional error boundaries

Thanks to React hooks you have now happily turned all your classes into functional components.

Wait, all your components? Not quite. There is one thing that can still only be implemented using classes: Error boundaries.

There is just no functional equivalent for componentDidCatch and deriveStateFromError yet.

Proposed solution

@moyix
moyix / aigen.php
Last active Feb 27, 2019
PHP code generated by GPT-2
View aigen.php
<?php
require ' vendor/autoload.php ' ;
/**
* Handles an HTTP request that contains information for registering/unregistering
* a FNA application.
@mschnetzer
mschnetzer / selfassessment.r
Last active Dec 31, 2019
Current and estimated position in the net wealth distribution (https://twitter.com/matschnetzer/status/1090954828631732224)
View selfassessment.r
library(tidyverse)
library(survey)
library(msthemes)
library(gganimate)
# Load HFCS and Non-core data
load("hfcs2014AT.rda")
load("Noncore AT/non-core-at.rda")
# Calculate estimated decile with mean from multiple imputation data
View for-snook.md

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.