Skip to content

Instantly share code, notes, and snippets.

View lxe's full-sized avatar
🦀
Crab

Aleksey Smolenchuk lxe

🦀
Crab
View GitHub Profile
@lxe
lxe / doge.cc
Created February 20, 2021 08:44
// Be in Arduino
// Go to file -> preferences -> settings tab -> additional board manager URL
// Paste this: https://dl.espressif.com/dl/package_esp32_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json
// Go to tools -> board -> board manager
// Find "esp32" and install it
// Copy https://github.com/Bodmer/TFT_eSPI into C:\Users\you\Documents\Arduino\libraries
@lxe
lxe / ches.html
Created December 1, 2020 03:02
ches
<html>
<head>
<title>Chess</title>
<meta name="viewport" content="width=800, initial-scale=1, maximum-scale=1">
<style>
body {
/* zoom: 0.5; */
margin: 0;
padding: 0;
@lxe
lxe / goestilevideo.sh
Created April 9, 2020 19:32
goestilevideo.sh
#!/bin/bash
# Usage: ./goestiles ~/goes17 2020-04-02
# Makes a video like this: https://twitter.com/lxe/status/1248117991067095040
# Requirements: imagemagick and ffmpeg
ROOT=$1
DATE=$2
# Clean up
@lxe
lxe / is-this-flux.md
Last active September 23, 2018 20:17
Simple React Flux/Redux Alternative

1. One global mutable (oh no) store:

const Store = {
  name: 'My Name',
  counter: 0
}

window.Store = Store; // Convenient!
@lxe
lxe / goes16-rtlsdr.md
Last active September 18, 2025 04:30
Receive GOES-16 and GOES-17 Images with a Raspberry Pi and RTL-SDR dongle

Let's say a library developer Bob builds a module/library that exports a reducer and and action. He publishes the module to npm:

const INITIAL_STATE = { timesPoked : 0 };

export function makeSharedModuleAction(payload) {
  return { 'type': 'POKE', payload };
}

export function sharedModuleReducer(state = INITIAL_STATE, action) {
@lxe
lxe / montyhall.js
Created August 4, 2018 16:49
Monty Hall Problem Simulation
const winsIfSwitched = [];
const winsIfStayed = [];
function monty () {
const doorWithCar = Math.floor(Math.random() * 3);
const guessedDoor = Math.floor(Math.random() * 3);
// Host removes a door that...
const removedDoor = [0,0,0].reduce((result, n, index) => {
// 1) contestant didn't pick and...
@lxe
lxe / keybase.md
Created December 19, 2017 01:05
keybase.md

Keybase proof

I hereby claim:

  • I am lxe on github.
  • I am lxe (https://keybase.io/lxe) on keybase.
  • I have a public key whose fingerprint is A5EB BBE1 8756 D076 7335 5299 DB75 F538 D74F 76CF

To claim this, I am signing this object:

package main
import (
"encoding/json"
"errors"
"fmt"
"reflect"
"strconv"
)
@lxe
lxe / semver.sh
Last active February 21, 2025 14:20
Semver range validator in bash (using sed, grep, and bc)
#!/bin/bash
# set -x
# Stupid Simple Semver range validator
# (no build metadata and no prereleases, and no multiple ranges (||))
# Prints a list of versions that match a semver range
# ./semver.sh "range" version version version...