This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "logger" | |
| module Loggable | |
| attr_accessor :logger | |
| def initialize(*args, logger: nil, **options, &block) | |
| @logger = logger || default_logger | |
| super(*args, **options, &block) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ----- Ultrasonic Sensor ----- | |
| const int TRIG_PIN = 10; | |
| const int ECHO_PIN = 11; | |
| // ----- Piezoelectric buzzer ----- | |
| const int PIEZO_PIN = 8; | |
| // LED pins | |
| const int RED_LED_PIN = 3; // Red LED: No response or max distance | |
| const int YELLOW_LED_PIN = 5; // Yellow LED: Object detected at all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Photocell Meter - Jack Willis <jack@attac.us> | |
| This sketch turns an Arduino into a creative light meter for art or interactive projects. | |
| It reads the ambient light from a photocell on pin A0, then lights up four LEDs (Red, Yellow, Green, Blue) | |
| at different brightnesses based on a bell-curve (Gaussian) calculation. Each LED "peaks" at a certain | |
| range of light, creating a smooth gradient of color feedback as light changes. | |
| Circuit Setup: | |
| 1. Photocell Voltage Divider: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sinatra' | |
| get '/' do | |
| 'Hello from root' | |
| end | |
| get '/foo' do | |
| 'Hello from GET /foo' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if status is-interactive | |
| # Commands to run in interactive sessions can go here | |
| end | |
| status --is-login; and status --is-interactive; and exec byobu-launcher | |
| function rainbowify | |
| # Define a set of RGB colors for the rainbow | |
| set colors '255;0;0' '255;69;0' '255;140;0' '255;165;0' '255;215;0' '255;255;0' '218;255;0' '140;255;0' '69;255;0' '0;255;0' '0;255;69' '0;255;140' '0;255;215' '0;255;255' '0;215;255' '0;140;255' '0;69;255' '0;0;255' '69;0;255' '140;0;255' '215;0;255' '255;0;255' '255;0;215' '255;0;140' '255;0;69' | |
| set colored_text '' | |
| set char_index 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'set' | |
| module GSM7 | |
| # https://en.wikipedia.org/wiki/GSM_03.38#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_/_GSM_03.38 | |
| BASIC_CHARACTER_SET = Set.new([ | |
| "\n", "\r", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "_", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "¡", "£", "¤", "¥", "§", "¿", "Ä", "Å", "Æ", "Ç", "É", "Ñ", "Ö", "Ø", "Ü", "ß", "à", "ä", "å", "æ", "è", "é", "ì", "ñ", "ò", "ö", "ø", "ù", "ü", "Γ", "Δ", "Θ", "Λ", "Ξ", "Π", "Σ", "Φ", "Ψ", "Ω" | |
| ]).freeze | |
| def self.basic_characters_only?(string) | |
| Set.new(string.chars).subset?(BASIC_CHARACTER_SET) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern crate num_rational; // 0.1 | |
| extern crate rusttype; // 0.6 | |
| use num_rational::Ratio; | |
| use rusttype::{Font, FontCollection, Glyph, Rect}; | |
| fn main() { | |
| let filename = "C:\\WINDOWS\\Fonts\\Tahoma.ttf"; | |
| let font = read_font_from_filename(filename); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'execjs' | |
| module Katex | |
| class << self | |
| JS_FILENAME = 'vendor/katex/katex.min.js' | |
| JS_CTX = ::ExecJS.compile(File.read(JS_FILENAME)) | |
| INLINE_REGEX = /\\\((.*?)\\\)/m.freeze | |
| DISPLAY_REGEX = /\\\[(.*?)\\\]/m.freeze |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| import OLSystem (OLSystem, buildSystem, stepSystem, axiom) | |
| import Data.Sequence (iterateN) | |
| main = do | |
| let algae = buildSystem "A" [ ('A', "AB"), ('B', "A") ] | |
| print $ axiom <$> iterateN 7 stepSystem algae | |
| -- ["A", "AB", "ABA", "ABAAB", "ABAABABA", "ABAABABAABAAB", "ABAABABAABAABABAABABA"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Flower where | |
| -- there's probably mistakes in here, also it is not a serious model of the flower | |
| data Pedicel = Pedicel | |
| data Tepal = Tepal | |
| data Sepal = Sepal | |
| data Petal = Petal | |
| data Perigonium = Perigonium [Tepal] |
NewerOlder