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
#!/bin/python | |
import re | |
import argparse | |
from datetime import datetime, timedelta | |
def parse_time(time_str): | |
"""Convert SRT timestamp to total seconds.""" | |
hours, minutes, seconds = time_str.replace(',', '.').split(':') | |
return int(hours) * 3600 + int(minutes) * 60 + float(seconds) |
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
extends Camera2D | |
# Camera that reacts to window resizing | |
@export var acceleration: float = 500 | |
@export var max_speed: float = 1000 | |
var resolution: Vector2 = Vector2(0, 0) | |
var velocity: Vector2 = Vector2(0, 0) |
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
77751 execve("./createns", ["./createns"], 0x7ffc4c85d930 /* 59 vars */) = 0 | |
77751 brk(NULL) = 0x560705217000 | |
77751 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd14a69e90) = -1 EINVAL (Invalid argument) | |
77751 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
77751 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 | |
77751 fstat(3, {st_mode=S_IFREG|0644, st_size=324747, ...}) = 0 | |
77751 mmap(NULL, 324747, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fea6f996000 | |
77751 close(3) = 0 | |
77751 openat(AT_FDCWD, "/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3 | |
77751 read(3, "\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x3e\x00\x01\x00\x00\x00\x20\x30\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x10\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x38\x00\x0b\x00\x40\x00\x24\x00\x23\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2 |
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
// https://www.reddit.com/r/rust/comments/jeu7xj/faang_interview_question_in_rust/ | |
// Given an MxN array of “boxes”, where each box contains some number of coins C[i][j], | |
// you want to maximize the number of coins you can take. You take coins by traversing | |
// row by row, taking all of the coins from ONE box in each row. However, any time you | |
// change the index of the box you take coins from, you must pay a “change fee” equal | |
// to ABS(x - y) where x and y are the previous and new row indices. Write a function | |
// that can determine the optimal set of boxes to take coins from in order to maximize | |
// your profit after change fees |
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; | |
fn main() { | |
println!("{:?}", word2chars("pear")); | |
println!("{:?}", needed_chars(&["apple", "pear"])); | |
} | |
fn needed_chars(words: &[&str]) -> HashMap<char, u32> { | |
words | |
.iter() |
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::error::Error; | |
use std::time::{Duration, Instant}; | |
use tokio::net::TcpStream; | |
use tokio::prelude::*; | |
#[tokio::main] | |
async fn main() -> Result<(), Box<dyn Error>> { | |
let now = Instant::now(); | |
task("task1", &now).await?; |
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
// Cargo.toml | |
[package] | |
name = "maxsubarray" | |
version = "0.1.0" | |
edition = "2018" | |
[dependencies] | |
[dev-dependencies] | |
criterion = "0.3.1" |
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
[ 1090.825] (WW) Failed to open protocol names file lib/xorg/protocol.txt | |
[ 1090.826] | |
X.Org X Server 1.20.8 | |
X Protocol Version 11, Revision 0 | |
[ 1090.826] Build Operating System: Linux Alpine Linux | |
[ 1090.826] Current Operating System: Linux falco 3.4.113 #6-postmarketOS SMP PREEMPT Tue Nov 5 06:54:09 UTC 2019 armv7l | |
[ 1090.826] Kernel command line: androidboot.bootdevice=msm_sdcc.1 androidboot.hardware=qcom vmalloc=400M utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags buildvariant=userdebug androidboot.bootdevice=msm_sdcc.1 androidboot.hardware=qcom vmalloc=400M utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags buildvariant=userdebug androidboot.emmc=true androidboot.serialno=TA92903XW6 androidboot.baseband=msm androidboot.mode=normal androidboot.device=falcon androidboot.hwrev=0x83C0 androidboot.radio=0x1 androidboot.powerup_reason=0x00100000 bootreason=hardware_reset androidboot.write_protect=0 restart.download_mode=0 androidboot.fsg-id= androidboot.secure_hardware=1 androidboot.cid=0 |
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::mem::MaybeUninit; | |
impl Solution { | |
pub fn is_alien_sorted(words: Vec<String>, order: String) -> bool { | |
let order_arr = Solution::get_order_arr(order); | |
words | |
.as_slice() | |
.windows(2) | |
.map(|x| Solution::check_pair(x[0].as_bytes(), x[1].as_bytes(), &order_arr)) |
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
model = SARIMAX(data1, exog=data2, order=(1, 1, 2), seasonal_order=(1, 1, 1, 52)) | |
model_fit = model.fit(disp=False) | |
print(f"Global: {model_fit.summary()}") | |
for site in sites: | |
# make prediction | |
newdfinner = df_site.loc[df_site.site == site, :].fillna(0).reset_index(drop=True) | |
exog2 = newdfinner.loc[ | |
newdfinner["start_week_dt"] >= last_sunday, ["exog1", "exog2"] |
NewerOlder