Skip to content

Instantly share code, notes, and snippets.

View iliakonnov's full-sized avatar
🦕

Ilia Konnov iliakonnov

🦕
View GitHub Profile
package ifaces
import (
"unsafe"
)
// Preparations
// ---------------------
// Basic interface `Iface` and a basic struct `Impl` implementing it
def getChar(x, y, accuracy, fns):
d = 1 / accuracy / 2
res = ' '
clr = 0
n = 0
for fn in fns:
ll = 1 if fn(x, y)[0] else 0
lr = 2 if fn(x + d, y)[0] else 0
ul = 4 if fn(x, y + d)[0] else 0
ur = 8 if fn(x + d, y + d)[0] else 0
@iliakonnov
iliakonnov / light.sh
Created June 19, 2023 08:48
Sets same brightness on all displays
#!/bin/sh
set -e
lvl="$(brightnessctl -p -e -m s "$@" | cut -d, -f4)"
for i in $(brightnessctl -l -c 'backlight' -m | cut -d, -f1); do
echo "adjusting $i"
brightnessctl -e -d "$i" s "$lvl" &
done
wait
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import { makeScene2D } from '@motion-canvas/2d/lib/scenes';
import { createRef } from '@motion-canvas/core/lib/utils';
import { MathTex } from '../components/manim_tex';
import { all, chain, waitFor } from '@motion-canvas/core/lib/flow';
import chroma from 'chroma-js';
export default makeScene2D(function* (view) {
let tex = createRef<MathTex>();
view.add(<MathTex tex={""} scale={0.25} currentColor={chroma("white")} ref={tex} />);
@iliakonnov
iliakonnov / fread_128TiB.url
Last active November 5, 2022 20:12
Doing fread on 128TB buffer
https://f.sldr.xyz/r/nMaMfjjWZs2WmDirit6Brx8Z

Что это?

Гуглоскрипт, который берёт моё расписания из РУЗа в гуглокалендарь, что позволяет:

  • заранее понимать какие пары я пропущу
  • получать своевременные напоминания
  • видеть нужную аудиторию прямо на стандартном виджете часов

image

Настройка

@iliakonnov
iliakonnov / apache.scc
Created March 19, 2020 17:19
sloc in chromium and in other projects
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Blanks Comments Code Complexity
───────────────────────────────────────────────────────────────────────────────
C 352 288903 35009 41638 212256 45085
XML 281 93275 13604 5176 74495 0
HTML 262 4608 926 8 3674 0
Forth 244 93006 13524 0 79482 656
C Header 197 38049 4830 19153 14066 285
Autoconf 80 6398 778 1832 3788 500
m4 56 3842 416 89 3337 0

Версия 1.0, на баше

Это простейший CGI-скрипт, который в ответ на json от телеграма дергает РУЗ, берет другой json и выдаёт ещё один json с сообщением. Не вижу смысла для перекладывания джсонов тащить что-то сложнее баша, так что вот.

Чтобы его поднять, нужно:

  1. Иметь nginx, домен и настроенный https к нему (можно self-signed).
  2. Поднять в нём поддержку CGI. Например, при помощи fcgiwrap.
from dataclasses import dataclass, replace
from functools import wraps
from math import sin
SYMBOL_HEIGHT, SYMBOL_WIDTH, USE_COLORS = {
'1x1': (1, 1, True),
'2x2': (2, 2, True),
'braille': (4, 2, False),
}['2x2']