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 sys | |
from typing import Optional | |
def dist(xs: list[str], i: int, k: int) -> int: | |
return sum(c1 != c2 for c1, c2 in zip(xs[i + k], xs[i - k - 1], strict=True)) | |
def weak_palindromes(xs: list[str]) -> list[tuple[int, Optional[int]]]: | |
left = 0 |
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
BIN = main | |
CXXFLAGS = -Wall -Wextra -std=c++20 | |
CPPFLAGS = -MMD | |
SRCS = $(wildcard *.cc) | |
OBJS = $(SRCS:.cc=.o) | |
DEPS = $(SRCS:.cc=.d) | |
LINK.o = $(CXX) $(LDFLAGS) $(TARGET_ARCH) | |
.PHONY: all |
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
package fun.nightuser; | |
import java.time.Clock; | |
import java.time.Duration; | |
import java.time.Instant; | |
import java.time.ZoneId; | |
import java.time.ZoneOffset; | |
public class AdjustableClock extends Clock { | |
private Clock fixedClock; |
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
#!/usr/bin/env python3 | |
import re | |
import portage | |
import shlex | |
optfeature_re = re.compile(r'optfeature\s+(.*)$') | |
packages = portage.db[portage.root]['vartree'].dbapi.cpv_all() |
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
Add an option to use the existing Xorg session with | |
chrome-remote-desktop. | |
The original idea of the patch: https://superuser.com/a/850359 | |
--- a/chrome-remote-desktop 2024-03-27 16:03:20.518579015 +0000 | |
+++ b/chrome-remote-desktop 2024-03-27 16:17:58.241912847 +0000 | |
@@ -110,6 +110,8 @@ | |
X_LOCK_FILE_TEMPLATE = "/tmp/.X%d-lock" | |
FIRST_X_DISPLAY_NUMBER = 20 |
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 <algorithm> | |
#include <iostream> | |
#include <vector> | |
#include <csignal> | |
using std::cout; | |
using std::endl; | |
using vint = std::vector<int>; | |
int const kBase = 100; |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import bisect | |
import numpy as np | |
from functools import total_ordering | |
from numpy.random import normal | |
from pylab import * | |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
from functools import cmp_to_key | |
from pylab import * | |
from scipy import stats | |
def standard_simplex_draw_point(n): |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
from sympy import Poly, Symbol | |
from scipy.signal import fftconvolve | |
x = Symbol('x') | |
k = 19937 |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
from sympy import pollard_rho | |
from sympy.core.numbers import igcd | |
from sympy.ntheory import sqrt_mod, nthroot_mod, isprime, factorint | |
from sympy.ntheory.modular import crt | |
with open('bbs.txt', 'r') as f: | |
xs = [int(x.rstrip()) for x in f.readlines()] |
NewerOlder