Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

// db.episodes.findOne({})
{
"_id" : ObjectId("5e8563a07aeda6f729a56e33"),
"data" : {
"date_gmt" : "2020-03-30T10:00:08"
}
}
resource 'definitions'
%w(flashcards multichoice type).each do |name|
get name, to: "definitions##{name}"
### I want to define a 'get' resource within definitions from within here...
end
#resource 'definitions' do
# get 'flashcards'
#end
//I want the larger end of this object:
translate([-73,0,0]) rotate([0,90,0]) cylinder(h=73, d1=16, d2=0, center=false, $fn=100);
// to resemble the corresponding end of this object:
intersection() {
translate([-73+16/2,0,0]) {
difference() { cylinder(h=16, d1=16, d2=16); translate([0,-10,0]) cube(73,16,16); }
}
translate([-73,0,0]) rotate([0,90,0]) cylinder(h=73, d1=16, d2=0, center=false, $fn=100);
require 'fileutils'
floppy_location = '/Volumes/floppy'
files = Dir['/tmp/Mac OS 8.1/*.img.*']
files.each do |file|
puts "#{Time.now}:\t#{file}"
# Wait until floppy is mounted...
until File.exists?(floppy_location) do
var data = `
OUT: 1111
OUT: andy
OUT: 121 OUT: 1324
NOTOUT: 1114
IN: 144`;
@advorak
advorak / spi_shift_register.c
Created September 3, 2016 07:38
...trying to figure out why the variable 'andy' on line 79 is sent as 10111010 even though the shift register has set 10111011.. is this a problem with an extra bit shifting the register over? ...is this a problem with MSB/LSB? </lost>
#include <avr/io.h> //Include the headers that handles Input/Output function for AVR chips
#include "spi_shift_register.h"
#include <util/delay.h> //Include the headers that allow for a delay function
#include <avr/interrupt.h>
#include <inttypes.h>
#include <util/setbaud.h>
//#include <stdlib.h>
//#include <string.h>
#include <stdio.h>
@advorak
advorak / bits.rb
Created August 25, 2016 06:43
bitwise
starting_point = 0b11011101
ending_point = 0b10111001
bits_to_change = starting_point ^ ending_point #=> "0b01100100"
on_bits = ending_point & bits_to_change #=> "0b00100000"
off_bits = starting_point & bits_to_change#=> "0b01000100"
@advorak
advorak / toggle_led_bitmath.c
Created August 25, 2016 06:34
Uses bitmath to assess an 8 bit register of switches and notes any recently-depressed switches to toggle LED lights on a separate register of 8 bits...
/*
* toggle_led_bitmath.c
* Description: Uses bitmath to assess an 8 bit register of switches
* and notes any recently-depressed switches to toggle
* LED lights on a separate register of 8 bits...
*/
#define F_CPU 16000000UL //Define the speed the clock is running at. Used for the delay.h functions
#include <avr/io.h> //Include the headers that handles Input/Output function for AVR chips
my_page_data = @pages.collect(&:to_s)
my_signed_on_data = my_page_data.group_by{|t| t.match /((?:[A-Z]|-| )+EXTRA BOARD|BLK|RUN)/;$1.strip unless $1.nil?}.reject{|k,v| k.nil?}
my_signed_on_data.inject({}) do |memo,obj|
obj[1] = obj[1].join "\n"
obj[1] = case obj[0]
when "BLK"
obj[1].scan(/^\s*((?:(?:C|M)_)?\d{4})\s+\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|.*?\$(\d{4}\.\d{2})\s*\$(\d{4}\.\d{2})/).collect{|blks| Hash[[[:block_number, :saturday, :sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :cap_id, :name, :bi_weekly_pay_school, :bi_weekly_pay_non_school],blks].transpose]}
when "RUN"
class Person < ActiveRecord::Base
include Backburner::Performable
queue_priority 500
def self.make_person(name, options = {})
self.create name: name, guid: options[:guid]
end
def self.work