Skip to content

Instantly share code, notes, and snippets.

View alpaylan's full-sized avatar

Alperen Keleş alpaylan

View GitHub Profile
def sort_test_1():
l = [2, 1, 3, 4]
sorted_l = dummy_sort(l)
assert sorted_l == [1, 2, 3, 4]
def get_all_possible_roasters(roaster):
# Rules
# Players: 1 PG | 1 SG | 1 G | 1 SF | 1 PF | 1 F | 3 C | 3 Util | 4 BN
# Roaster: 1 PG | 1 SG | 1 G | 1 SF | 1 PF | 1 F | 3 C | 3 Util
# The task is to create all possible roasters from the given roaster
roles = {
"PG": 0,
"SG": 1,
use std::vec;
#[derive(Debug, Clone)]
pub enum BinaryTree<K, V> {
Leaf,
Node(Box<BinaryTree<K, V>>, (K, V), Box<BinaryTree<K, V>>),
}
impl<K, V> BinaryTree<K, V> {
pub fn new() -> Self {
Require Import Coq.Strings.String.
Require Import Ascii.
Local Open Scope nat_scope.
Inductive Rope :=
| Leaf : string -> nat -> Rope
| Node : Rope -> nat -> Rope -> Rope.
Definition mkRope (s : string) : Rope :=
#![feature(is_sorted)]
use std::vec;
use rand::Rng;
fn construct(input: &Vec<char>, realized_vector: &mut Vec<u64>, i: usize, n: u64) {
if i == input.len() {
realized_vector.push(n);
return;
}
This file has been truncated, but you can view the full file.
0
0-._.-._.-._.-._.-._.-._.-0
000
00000
0000000
00000000
000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0.0.1
00101s
prop1 = lambda n : n % 2 == 0
prop2 = lambda n : n % 3 == 0
prop3 = lambda n : n % 5 == 0
inputs = list(range(1, 1000))
use std::fmt::Debug;
use std::fmt::Display;
use std::fmt;
struct DoubleLinkedList<T> {
arr: Vec<T>,
valid: Vec<bool>,
}
type Color = "blue" | "pink";
type Canvas = Color[][];
const generateCanvas = (): Canvas => {
// A Canvas is a 3x3 grid of colors
const genColor = (): Color => {
return Math.random() > 0.5 ? "blue" : "pink";
@alpaylan
alpaylan / pdf-separator.py
Created April 25, 2024 21:59
Heuristically splits a book pdf into chapters
# This script takes a PDF book, splits it into chapters, and saves each chapter as a separate PDF file.
import PyPDF2
import re
# Open the PDF file
pdf_file = open('book.pdf', 'rb')
pdf_reader = PyPDF2.PdfReader(pdf_file)