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 from "react"; | |
import Plot from "react-plotly.js"; | |
import SPESimulator from "../math/spe_sim" | |
export default class SolarPanelEfficiency extends React.Component { | |
constructor(props) { | |
super(props); | |
this.d_step = 0.5; |
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
root@project:~# cat /service/hal/run | |
#!/bin/bash | |
echo "$(date): waiting for dependency1 to be up" | |
s6-svwait -u /service/dependency1 | |
echo "$(date): starting hal" | |
exec 2>&1 /opt/ninox/hal | |
root@project:~# ps aux | grep s6 | |
root 2684 0.0 0.1 1676 932 pts/2 S+ 12:58 0:00 s6-svscan /service |
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 requests | |
import re | |
url = "https://permanent-redirect.xyz/pages/1515222320" | |
body = None | |
while body is None or "301 Permanent Redirect" in body: | |
body = requests.get(url).text | |
if "500 Internal Server Error" in body: | |
print("Internal server error, continuing") |
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
def day1(seq, cmp): | |
return functools.reduce(operator.add, map(lambda ic: int(ic[1]), filter(cmp, enumerate(seq)))) | |
def day1_part1(seq): | |
return day1(seq, lambda ic: ic[1] == seq[ic[0]-1]) | |
def day1_part2(seq): | |
return day1(seq, lambda ic: ic[1] == seq[(ic[0] + (len(seq) // 2)) % len(seq)]) |
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
use piece::Piece; | |
use coords::Coords; | |
#[derive(Debug)] | |
pub struct Move { | |
pub piece: Piece, | |
pub dst: Coords | |
} | |
#[derive(Debug)] |
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
mod piece; | |
mod square; | |
mod sentence; | |
mod board; | |
mod coords; | |
use sentence::Sentence; | |
use board::Board; | |
use piece::Color; |
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
use std::fmt; | |
use std::char; | |
#[derive(Debug, Clone, Copy)] | |
enum Piece { | |
King, | |
Queen, | |
Rook, | |
Bishop, | |
Knight, |
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 json | |
class Config: | |
def __init__(self): | |
self._path = None | |
self._config = {} | |
def open(self, path): | |
self._path = path |
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
use std::collections::HashMap; | |
use std::vec::Vec; | |
use std::iter::Iterator; | |
use std::str; | |
use byteorder::{ByteOrder, LittleEndian}; | |
type SizeMap<'a> = HashMap<Vec<&'a str>, usize>; | |
fn element_size<'a, I>(path: I, bytes: &'a [u8]) -> (SizeMap<'a>, usize) | |
where I: IntoIterator<Item = &'a str> { |
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
// ... | |
type SizeMap = HashMap<Vec<String>, u32>; | |
fn document_size(bytes: &[u8]) -> SizeMap { | |
// ... | |
} | |
#[cfg(test)] | |
mod tests { |