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 sympy import symbols, solve, Eq | |
def knight_moves(x, y, board_size=8): | |
moves = [ | |
(x + 1, y + 2), | |
(x + 1, y - 2), | |
(x - 1, y + 2), | |
(x - 1, y - 2), | |
(x + 2, y + 1), |
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
#### --- Python.gitignore from github.com/github/gitignore --- | |
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so |
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 <Adafruit_MotorShield.h> | |
#include <BlockNot.h> | |
#include <math.h> | |
// Pin IO | |
const int pinLineSensor1 = A0; | |
const int pinLineSensor2 = A1; | |
const int pinLineSensor3 = A2; |
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 ics import Calendar, Event | |
from datetime import datetime, timedelta | |
# init the calendar | |
cal = Calendar() | |
def new(topic, weeks, days): | |
for week in [timedelta(days=w*7) for w in weeks]: | |
event = Event() | |
event.name = topic + ' Supo' |
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
DIRECTORY=. | |
for FILEPATH in $DIRECTORY/PDF-*.pdf; do | |
FILENAME="$(basename "$FILEPATH" .pdf)_A4" | |
pdftocairo -pdf -paper A4 $FILEPATH processed/$FILENAME.pdf | |
mv $FILEPATH processed/ | |
done |
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 logging | |
from logging.handlers import RotatingFileHandler | |
file_handler = RotatingFileHandler("my_log.log", backupCount=5) | |
file_handler.doRollover() | |
logging.basicConfig( | |
level=logging.INFO, | |
format="%(asctime)s [%(levelname)s] %(message)s", | |
handlers=[ |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<script src="https://d3js.org/d3.v3.min.js"></script> | |
<script src="https://rawgit.com/jasondavies/d3-cloud/master/build/d3.layout.cloud.js"></script> | |
<script> | |
//Based on https://github.com/jasondavies/d3-cloud/blob/master/examples/simple.html | |
// Encapsulate the word cloud functionality |
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
use core::ops::Range; | |
fn main() { | |
let quote = String::from("I scream, you scream, we all scream for ice cream"); | |
assert_eq!("e[2..8], "scream"); | |
assert_eq!("e[14..20], "scream"); | |
assert_eq!("e[29..35], "scream"); | |
// substring_index("e, "scream") | |
assert_eq!(substring_index("e, "e[2..8]), 2..8); |
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
### A Pluto.jl notebook ### | |
# v0.12.18 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ 04587fae-597f-11eb-03db-41e2e288cabc | |
using VideoIO, ImageFiltering, Images, Plots | |
# ╔═╡ a522894e-59b5-11eb-147f-71052ad6df32 |