Skip to content

Instantly share code, notes, and snippets.

View NoraCodes's full-sized avatar
🦀
rusting away

Leonora Tindall NoraCodes

🦀
rusting away
View GitHub Profile
@NoraCodes
NoraCodes / upload.sh
Created July 2, 2018 16:53
Script to upload things to Google Cloud Storage via OAuth bearer token
!/bin/bash
set -e
usage () {
echo "Usage:"
echo " upload.sh [object] [bucket] [OAuth bearer token]"
}
[ -z "$1" ] && echo "ERROR: No local object name supplied." && usage && exit 1
@NoraCodes
NoraCodes / gogs.log
Created March 17, 2018 13:24
Gogs bus error!
2018/03/17 00:02:47 [TRACE] CSRF Token: wdQKEuNtsm5y3e9LVcX2dqHz9J86MTUyMTI0NDk2NzUwNDU5NzY1Ng==
2018/03/17 00:03:07 [TRACE] Detected encoding: UTF-8 (fast)
2018/03/17 00:04:00 [TRACE] Template: repo/home
2018/03/17 00:05:42 [TRACE] Doing: MirrorUpdate
2018/03/17 00:06:33 [TRACE] Session ID: bb8e5fa9c54b3597
2018/03/17 00:06:33 [TRACE] CSRF Token: weRrgVR3UOU7MLYD4m5w1MiWhTc6MTUyMTI0NTE5MzU5OTM0MTc4MA==
2018/03/17 00:06:44 [TRACE] Template: repo/commits
2018/03/17 00:08:04 [TRACE] Session ID: ec81973c58f48efe
2018/03/17 00:08:04 [TRACE] CSRF Token: ETWb5YGr3ZZeU9E9z5ZZ0iMn6_Q6MTUyMTI0NTI4NDAwNTI0MDEwMA==
2018/03/17 00:08:04 [TRACE] Template: user/profile
@NoraCodes
NoraCodes / esp8266_scan.ino
Last active October 18, 2022 10:35
Network scanner on ESP8266
/**
* ESP8266 Scanner - Scans for networks on the 2.4GHz band and prints them out to the console.
* Program it onto your ESP8266, pull up miniterm, the Serial Monitor, etc, and view a list of
* wireless networks on your computer.
* Requres Arduino JSON (http://arduinojson.org/), downloadable from Library Manager or GitHub.
* Or, set OUTPUT_JSON and consume the serial output with your favorite JSON parser.
*
* Created by Leonora Tindall in 2017 for the ESP8266.
* This software is licensed under the GNU General Public License, Version 3.0.
*/
@NoraCodes
NoraCodes / work_queue.rs
Last active February 21, 2024 15:27
An example of a parallel work scheduling system using only the Rust standard library
// Here is an extremely simple version of work scheduling for multiple
// processors.
//
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
//
// The Solution:
@NoraCodes
NoraCodes / turing_drawings.txt
Last active November 6, 2018 20:32
Cool Turing Drawing images
Some Polygons (still)
http://maximecb.github.io/Turing-Drawings/#4,2,3,1,3,3,1,2,2,1,0,0,1,0,1,1,2,3,1,0,2,1,1,0,1,2
Moving Shapes (flashing)
http://maximecb.github.io/Turing-Drawings/#4,3,3,2,3,0,2,3,2,1,3,0,1,0,2,1,2,2,2,0,1,1,3,0,2,1,2,2,0,0,1,0,1,2,3,2,2,0
Slashing Noise (flashing)
http://maximecb.github.io/Turing-Drawings/#3,8,0,1,1,1,3,1,1,6,3,1,7,3,1,3,0,1,1,1,2,4,2,1,7,2,1,4,1,1,1,3,1,4,0,1,6,1,2,4,3,2,7,2,1,7,2,2,2,1,1,6,1,0,2,0,0,2,1,2,2,3,1,2,2,2,1,1,2,7,2,1,4,0
Logarithmic Slide (smooth)

Keybase proof

I hereby claim:

  • I am noracodes on github.
  • I am lfstindall (https://keybase.io/lfstindall) on keybase.
  • I have a public key ASDPVOLEYOVU2GJ8igFZ2Iyb_CuFiYTXiubc7huxZ1Mzrwo

To claim this, I am signing this object:

@NoraCodes
NoraCodes / regexes.txt
Created April 26, 2017 17:25
Some Regular Expressions
Phone numbers:
(\+[0-9]{1,3}[. -/])?\(?[0-9]{3}\)?[. -/][0-9]{3}[. -/][0-9]{4}
1 2 3 4
Explaination:
1: (\+[0-9]{1,3}[. -/])? matches a country code like +1 or +999, and seperator
2: ?\(?[0-9]{3}\)? matches an area code with or without parentheses, like 858 or (858), and seperator
3: [0-9]{3}[. -/] matches an exchange number, and seperator
4: [0-9]{4} matches a 4-digit flop number
@NoraCodes
NoraCodes / fizzbuzz.go
Created April 26, 2017 15:57
A parallel FizzBuzz using Goroutines.
package main
import (
"fmt"
"strconv"
)
// Return a channel which will produce a stream of numbers
// from minimum to maximum minus one.
func intRange(minimum int, maximum int) <-chan int {
@NoraCodes
NoraCodes / hashtable.cpp
Last active April 17, 2017 19:19
A sample implementation of a hash table in C++11.
#include <iostream>
#include <random>
// The number of items to insert into the hash table in main()
#define ITEMS 32
// The size of the backing array for the hash table
#define HTSIZE 32
using namespace std;
@NoraCodes
NoraCodes / functional_squares.rs
Created March 28, 2017 04:19
A sample of functional computations in Rust.
// Generates the first 10 odd squares, lazily.
// [1, 9, 25, 49, 81, 121, 169, 225, 289, 361]
// That is, it takes an infinite sequence of squares and
// checks if each subsequent one is odd, until it finds
// ten that are.
fn main() {
let vector: Vec<_> = (1..) // Instructions to produce
// integers forever
.map(|x| x * x) // This is now instructions for