Skip to content

Instantly share code, notes, and snippets.

bool check_function(const char function_name[], const char input[]){
int len = 0;
while (function_name[len] != NULL){
len++;
}
if (strncmp(input, function_name, len) == 0) {
return true;
}
else {
return false;
int directionPin = 0;
int activationPin = 1;
int btnPin = 2;
int directionState = 0;
int btnState = 0;
int currentState = LOW;
int currentPosition = 0;
#include <TimerOne.h>
boolean firstRun = true; // Used for one-run-only stuffs;
//First pin being used for floppies, and the last pin. Used for looping over all pins.
const byte FIRST_PIN = 2;
const byte PIN_MAX = 17;
#define RESOLUTION 40 //Microsecond resolution for notes
int directionPin = 0;
int activationPin = 1;
boolean activationState = LOW;
boolean directionState = LOW;
int currentPosition = 0;
int maxPosition = 1;
void setup(){
pinMode(directionPin, OUTPUT);
class EventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(const SEvent& event)
{
return false;
}
};
/*
#!/usr/bin/env python3
import socket
import subprocess
import os
import netifaces
debug = True
def start():
@johan-bjareholt
johan-bjareholt / Speech recognition
Created December 8, 2015 15:54
Speech recognition on linux using Google Speech API
#!/bin/bash
# Record from mic
arecord -d 3 -f cd -t wav -r 16000 -c 1 -D pulse test.wav
# Get record volume
sox test.wav -n stats -s 16 2>&1 | grep 'Max level' | awk '{print $3}'
# Convert to flac for smaller footprint
flac -f test.wav
# Google speech recognition
LANG=en-us
#!/bin/bash
# 1. ss
# 2. Remove header
# 3. Only print ip
# 4. RegEx away port number
IPS=$(ss --tcp | tail -n +2 | awk '{ print $5 }' | sed -e 's/\(.*\):.*/\1/g')
COUNTRIES=""
for IP in $IPS; do
# 1. Geoiplookup