Skip to content

Instantly share code, notes, and snippets.

View yvan-sraka's full-sized avatar

Yvan Sraka yvan-sraka

View GitHub Profile
@yvan-sraka
yvan-sraka / wzip.py
Created February 20, 2023 09:46 — forked from ryancdotorg/wzip.py
Partial/streaming zip downloader
#!/usr/bin/env python3
# SPDX-License-Identifier: 0BSD or CC0-1.0 or MIT-0 or Unlicense
# Copyright (c) 2023, Ryan Castellucci, No Rights Reserved
import io, sys
import datetime
import argparse
import requests
import operator
import struct
@yvan-sraka
yvan-sraka / rusty-monoid.rs
Created February 16, 2023 21:30 — forked from snoyberg/rusty-monoid.rs
Rusty Monoid
#![feature(try_trait_v2)]
use std::ops::Try;
trait Monoid: Default {
fn mappend(self, rhs: Self) -> Self;
}
impl Monoid for i32 {
fn mappend(self, rhs: Self) -> Self {
self + rhs
fn main() {
let x = vec![1, 2, 3];
for i in 0..=x.len() {
println!("{}", x[i]);
}
}
#include <stdio.h>
#include <stdlib.h>
typedef enum {
MOV,
SET,
ADD,
SUB,
JMP,
SYSCALL,
import functools
def memoization(f):
cache = {}
def func_wrapper(n):
if n not in cache:
result = f(n)
cache[n] = result
return cache[n]
return func_wrapper
fn main() {
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
println!("Input: {}", input);
let result = input
.trim()
.chars()
.filter(|&ch| ch != '=')
.map(|ch| {
let ascii = ch as i8;
#! /usr/bin/env bash
old_path="$1"
new_path="../fixed/$(echo "$old_path" | iconv -f utf-8 -t ascii//translit)"
if [[ -d $old_path ]]; then
mkdir -p "$new_path"
elif [[ -f $old_path ]]; then
rsync -azP "$old_path" "$new_path"
fi
# angles.py - http://www.graphviz.org/Gallery/gradient/angles.html
from graphviz import Digraph
g = Digraph('G', filename='angles.gv')
g.attr(bgcolor='blue')
with g.subgraph(name='cluster_1') as c:
c.attr(fontcolor='white')
c.attr('node', shape='circle', style='filled', fillcolor='white:black',
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
TODO: C0111: Missing module docstring (missing-docstring)
"""
import os
from json import load
diff --git a/predict.py b/predict.py
index 716e2cd9..e2a2716f 100755
--- a/predict.py
+++ b/predict.py
@@ -90,24 +90,15 @@ def predict(foldrec_path: str, N=20, method: str='lr', verbose: bool=True):
key = (lambda x: x[2])
result.sort(key=key, reverse=True)
remove_all_pdbs('./tmp_pdb')
- for i in range(N):
+ for i in range(len(result)):