Skip to content

Instantly share code, notes, and snippets.

import java.util.Random;
public class RollSimulation {
public static void main(String[] args) {
Random rand = new Random();
for (int f = 1; f <= 6; f++) {
int[] rolls1 = new int[8];
int[] rolls2 = new int[8];
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#define NUM_TRIALS 1e9
int randint(int n);
unsigned int play(void);
int main(void) {
// make sure to unbind your device first
// https://stackoverflow.com/questions/47695160/failed-to-claim-interface-0-device-or-resource-busy
// echo -n "1-1.3:1.0" | sudo tee /sys/bus/usb/drivers/ch341/unbind
let device;
async function connectDevice(dev) {
await dev.open();
if (dev.configuration === null)
await dev.selectConfiguration(1).catch(error => { log(error); });
@ryanmjacobs
ryanmjacobs / c99_designators_in_const_struct.c
Last active April 25, 2018 23:25
Example of C99 Designator Clauses inside a `const struct`
// temp. includes so that the compiler doesn't complain
// (delete these three lines when you import the code)
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
struct spi_devices_struct {
char manu[10]; // ID winbond 0xef.
char device[10]; // ID string (ie W25Q16BV)
uint8_t manId; // manu ID
module ram(
input clk,
input rst,
input write_enable,
input [15:0] data_write,
inout [15:0] MemDB,
output reg [15:0] data_read,
output RamAdv, RamClk, RamCS, MemOE, MemWR, RamLB, RamUB,
name: TOPHAP
description: ''
host: EXCEL
api_set: {}
script:
content: |-
/**
* Fetch property details for an address string.
* Example: `console.log(await address('265 eagle ct', 'alamo', 'ca'))`
* @customfunction