This file contains 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
#!/usr/bin/env perl6 | |
# Reference: | |
# https://wiki.osdev.org/Partition_Table | |
my %ids = 0x00 => "Empty", 0x0b => "W95 FAT32", 0x0c => "W95 FAT32 (LBA)", | |
0x82 => "Linux swap", 0x83 => "Linux", 0x93 => "Amoeba"; | |
sub MAIN($filename) { | |
say "Disk: $filename"; |
This file contains 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
grammar G { | |
token TOP { <atom>* } | |
token atom { IFX { print "\n.. GOT IFX..\n"; } | |
| IF {print "\n--GOT IF--\n"; } | |
| . { print $/; } | |
} | |
} | |
my $str = "heIFllIFXo\n"; |
This file contains 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
----------------------------------------------- | |
--- Set Variables --- | |
----------------------------------------------- | |
--- WIFI CONFIGURATION --- | |
WIFI_SSID = "" | |
WIFI_PASSWORD = "" | |
WIFI_SIGNAL_MODE = wifi.PHYMODE_N | |
--- IP CONFIG (Leave blank to use DHCP) --- | |
ESP8266_IP="192.168.0.30" |
This file contains 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
: nneg 0 >= ; | |
: <times postpone >r postpone begin postpone r> postpone 1- postpone dup | |
postpone >r postpone nneg postpone while ; immediate | |
: times> postpone repeat postpone rdrop ; immediate | |
\ Simple usage: | |
: eg1 5 <times '. emit times> cr ; | |
eg1 | |
\ You can even embed blocks: |
This file contains 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
%serialconnect to --port=/dev/ttyUSB1 # for Jupyter | |
import machine, ssd1306 | |
i2c = machine.I2C(-1, scl=machine.Pin(22), sda=machine.Pin(21)) | |
oled = ssd1306.SSD1306_I2C(128, 64, i2c) | |
oled.fill(0) | |
oled.text('MicroPython on', 0, 0) | |
oled.text('attached SSD1306', 0, 20) | |
oled.text('OLED display', 0, 30) |
This file contains 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
#include <Arduino.h> | |
#include <WiFi.h> | |
#include <driver/dac.h> | |
const int dataPin = 4; // Blinkt pin 16 | |
const int clockPin = 5; // blinkt pin 18 | |
const int numLEDs = 8; | |
uint8_t pixels[numLEDs * 3]; | |
void spi_out(uint8_t n) { |
This file contains 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
#include <stdio.h> | |
#include <string.h> | |
#include "freertos/FreeRTOS.h" | |
#include "freertos/task.h" | |
#include "driver/gpio.h" | |
#include "sdkconfig.h" | |
#include <driver/dac.h> | |
// The 8-bit values in our sound sample | |
#include "track.h" |
This file contains 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
/* Blink Example | |
This example code is in the Public Domain (or CC0 licensed, at your option.) | |
Unless required by applicable law or agreed to in writing, this | |
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
CONDITIONS OF ANY KIND, either express or implied. | |
*/ | |
#include <stdio.h> | |
#include <string.h> |
This file contains 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
from machine import Pin, SPI | |
import ntptime | |
from utime import sleep_ms | |
import utime | |
import mel | |
rs_pin = Pin(2, Pin.OUT) # Pin D4. Do NOT use the regular MISO pin (D6) | |
cs_pin = Pin(15, Pin.OUT) # aka SS slave select | |
cs_pin.on() |
This file contains 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
import machine | |
import network | |
import time | |
# because we use onbaord GPIO, we invert the meaning of the pin | |
# so 0 turns it on, 1 turn it off | |
pin = machine.Pin(16, machine.Pin.OUT) | |
def poff(): pin.value(1) | |
def pon(): pin.value(0) | |
poff() |
NewerOlder