Skip to content

Instantly share code, notes, and snippets.

@nevercast
nevercast / test.java
Created January 27, 2012 10:00
Test HDD speeds
import java.io.File;
public class test {
/* Tests:
* 1. Time to create 2000 files
* 2. Time to list them
* 3. Time to delete all of them
* 4. Time to create 2000 files of 1kB each
* 5. Time to list them
* 6. Time to delete all of them
@nevercast
nevercast / TreePopulator.java
Created January 29, 2012 20:51
Tree Populator
/*
* This file is part of Vanilla (http://www.spout.org/).
*
* Vanilla is licensed under the SpoutDev License Version 1.
*
* Vanilla is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
[10:09:14] [INFO] Failed to poll device: Failed to poll device (8007000c)
[10:09:14] [INFO] Failed to poll device: Failed to poll device (8007000c)
[10:09:14] [INFO] Failed to poll device: Failed to poll device (8007000c)
... Repeated for about 1000 lines
[10:09:14] [INFO] Failed to poll device: Failed to poll device (8007000c)

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

[19:59:32] [Server thread/INFO]: NeverCast issued server command: /mcrank
[19:59:32] [pool-3-thread-81/WARN]: Exception in thread "pool-3-thread-81"
[19:59:32] [pool-3-thread-81/WARN]: org.apache.commons.lang.UnhandledException: Plugin mcMMO v1.5.01-SNAPSHOT-b3632 generated an exception while executing task 2653
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at java.util.EnumMap.typeCheck(Unknown Source)
at java.util.EnumMap.put(Unknown Source)
@nevercast
nevercast / gist:3d2c8d64b707bc05b0ff
Created November 15, 2014 08:05
Subscribe to Document up event.
didInsertElement: function() {
Em.$(document)
.on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function(e) {
console.log('HAVE CAKE');
});
},
@nevercast
nevercast / index.js
Created January 25, 2016 19:11
Creating routes from aurelia features
import {AppRouter, RouterConfiguration} from "aurelia-router";
export function configure(config) {
const router = config.container.get(AppRouter);
const routerConfig = config.container.get(RouterConfiguration);
routerConfig
.map([{ route: "foo", moduleId: "features/foo/foo", name: "foo", nav: true, title: "foo" }])
.exportToRouter(router);
}
@nevercast
nevercast / babel.js
Created June 7, 2018 05:12
Babel Polyfill loader for Azure Functions "only one instance of babel-polyfill is allowed"
/**
* Azure Functions can sometimes share a global scope to save memory (More than one function runs in the same interpreter).
* When this occurs, babel will try to load twice. This is bad.
*
* This file acts as a mediator to prevent it loading twice and always logs the result for my interest.
* Inside my webpack.config.js, instead of 'babel-polyfill', I have 'src/polyfill/babel' (this file).
*/
if (global._babelPolyfill) {
/* Polyfill is already loaded */
if (console && console.warn) {
@nevercast
nevercast / pixels.py
Last active November 20, 2022 17:34
Simple MicroPython ESP32 RMT NeoPixel / WS2812B driver.
# Copyright public licence and also I don't care.
# 2020 Josh "NeverCast" Lloyd.
from micropython import const
from esp32 import RMT
# The peripheral clock is 80MHz or 12.5 nanoseconds per clock.
# The smallest precision of timing requried for neopixels is
# 0.35us, but I've decided to go with 0.05 microseconds or
# 50 nanoseconds. 50 nanoseconds = 12.5 * 4 clocks.
# By dividing the 80MHz clock by 4 we get a clock every 50 nanoseconds.
@nevercast
nevercast / sideeffect.py
Created August 10, 2020 00:27
Check Python file for side effects on import
#!/usr/bin/env python
#### MIT Licence
# Copyright 2020 Josh "nevercast" Lloyd
# This notice must remain intact for all copies or substantial portions of the Software
####
# First release: 2020-08-10
from __future__ import print_function
import ast
import sys