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, I2C, time_pulse_us | |
from sh1106 import SH1106_I2C | |
from math import sin | |
from time import sleep_us, sleep_ms | |
i2c = I2C(0) | |
display = SH1106_I2C(128, 64, i2c) | |
trigger = Pin(16, Pin.OUT) | |
echo = Pin(17, Pin.IN) |
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 sys | |
import decoder | |
import encoder | |
if __name__ == "__main__": | |
if sys.argv[1] == "encode": | |
print(encoder.encode(sys.argv[2])) | |
elif sys.argv[1] == "decode": | |
print(decoder.decode(sys.argv[2])) |
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
package me.gotitim.guildscore.placeholders; | |
import org.bukkit.entity.Player; | |
import org.jetbrains.annotations.NotNull; | |
import java.util.HashMap; | |
import java.util.Locale; | |
import java.util.Map; | |
/** |
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 { existsSync, readFileSync, createWriteStream, writeFileSync } from "fs"; | |
const fileName = process.argv[2] | |
if (!existsSync(fileName)) { | |
console.log("Can't find file " + fileName) | |
process.exit(1) | |
} | |
const text = readFileSync(fileName, { encoding: 'utf-8' }).replace(/\r\n/g, "") | |
let totalLetters=0, totalLettersWithSpecialChars = 0 |
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
public class IslandPerimeter { | |
public static void main(String[] args) { // for tests | |
int p = new IslandPerimeter().islandPerimeter(new int[][]{{0,1,0,0},{1,1,1,0},{0,1,0,0},{1,1,0,0}}); | |
System.out.println(p); | |
} | |
public int islandPerimeter(int[][] grid) { | |
int perimeter = 0; | |
for(int i = 0; i < grid.length; i++) { |
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
const { WebhookClient } = require('discord.js'); | |
const readline = require('readline'); | |
const client = new WebhookClient({ url: "https://discord.com/api/webhooks/123/token" }) | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); |