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
| import { readFile } from 'fs/promises'; | |
| async function getData(): Promise<string[]> { | |
| try { | |
| const v = await readFile('input.txt', 'utf8'); | |
| return v.split('\n'); | |
| } catch (error) { | |
| console.error(error); | |
| return []; | |
| } |
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
| import { readFile } from 'fs/promises'; | |
| async function getData(): Promise<string[]> { | |
| try { | |
| const v = await readFile('input.txt', 'utf8'); | |
| return v.split('\n'); | |
| } catch (error) { | |
| console.error(error); | |
| return []; | |
| } |
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
| age = 31 | |
| print(age) | |
| next_age = age + 1 | |
| print(next_age) | |
| soup = 9.00 | |
| squid = 6.80 |
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
| KERNEL!="sd[b-z][0-9]", GOTO="automount_end" | |
| # Import FS infos | |
| IMPORT{program}="/sbin/blkid -o udev -p %N" | |
| # Get a label if present, otherwise specify one | |
| ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}" | |
| ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k" | |
| # Global mount options |
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
| import sys | |
| import zmq | |
| # Socket to talk to server | |
| context = zmq.Context() | |
| socket = context.socket(zmq.SUB) | |
| socket.connect("tcp://localhost:5556") |
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
| from periphery import SPI | |
| import time | |
| import random | |
| import json | |
| import zmq | |
| from random import randrange | |
| context = zmq.Context() | |
| socket = context.socket(zmq.PUB) | |
| socket.bind("tcp://*:5556") |
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
| from periphery import SPI | |
| import time | |
| import random | |
| # Open spidev1.0 with mode 0 and max speed 1MHz | |
| spi = SPI("/dev/spidev0.0", 0, 1000000) | |
| data_out = [0x00, 0x00, 0xcc, 0xdd] |
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
| import React, {useState} from 'react'; | |
| const Thing = props => { | |
| const [thingState, setThingState] = useState({number: 0}) | |
| const buttonHandler = () =>{ | |
| setThingState({ | |
| number: thingState.number + 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
| import os | |
| import re | |
| from PyPDF2 import PdfFileMerger | |
| def sorted_nicely( l ): | |
| """ Sorts the given iterable in the way that is expected. | |
| Required arguments: | |
| l -- The iterable to be sorted. |
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
| #include <Wire.h> | |
| #include <Adafruit_BMP085.h> | |
| #include "DHT.h" | |
| #define DHTPIN 2 // what digital pin we're connected to | |
| #define DHTTYPE DHT11 // DHT 11 | |
| //#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 | |
| //#define DHTTYPE DHT21 // DHT 21 (AM2301) |
NewerOlder