Skip to content

Instantly share code, notes, and snippets.

View reflechant's full-sized avatar

Roman Gerasimov reflechant

  • Amsterdam
View GitHub Profile
@reflechant
reflechant / ffxiv_dawntrail_steam_reviews.ipynb
Created October 8, 2024 19:47
Data analysis of FFXIV Dawntrail negative Steam reviews
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
package main
import (
"fmt"
"unsafe"
)
func stringptr(s string) *byte {
return unsafe.StringData(s)
}
@reflechant
reflechant / .zshrc
Last active September 14, 2024 17:12 — forked from roman2ing/.zshrc
if [[ ! -e ~/.zcomet/bin ]]; then
git clone --depth=1 https://github.com/agkozak/zcomet.git ~/.zcomet/bin
fi
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
source ~/.zcomet/bin/zcomet.zsh
@reflechant
reflechant / init.el
Last active October 21, 2024 07:38
my Emacs config
;; Set package repositories
(require 'package)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(eval-when-compile
(require 'use-package)
(require 'use-package-ensure))
@reflechant
reflechant / numpy-tutorial.ipynb
Created September 3, 2020 19:54
Numpy and plotting basics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reflechant
reflechant / konigsberg_bridges.py
Last active March 31, 2019 23:10
Поиск перебором решения задачи о 7-ми кенигсбергских мостах
'''
Программа для нахождения перебором решения задачи о 7-ми кенигсбергских мостах.
см. https://ru.wikipedia.org/wiki/%D0%97%D0%B0%D0%B4%D0%B0%D1%87%D0%B0_%D0%BE_%D1%81%D0%B5%D0%BC%D0%B8_%D0%BA%D1%91%D0%BD%D0%B8%D0%B3%D1%81%D0%B1%D0%B5%D1%80%D0%B3%D1%81%D0%BA%D0%B8%D1%85_%D0%BC%D0%BE%D1%81%D1%82%D0%B0%D1%85
Решения этой задачи не существует, что доказал Леонард Эйлер.
'''
bridges = (
(1, 2),
(1, 2),
@reflechant
reflechant / udp_chat.py
Created November 3, 2018 20:19
Simple chat for LAN using UDP (not finished)
import socket
import threading
addr = socket.gethostbyname(socket.gethostname())
port = 22000
srv_addr = (addr, port)
broadcast_addr = ".".join(addr.split('.')[:-1]) + '.255'
nport = 22001
n_srv_addr = (broadcast_addr, port)
@reflechant
reflechant / two_alarm_clocks.py
Last active September 14, 2018 20:17
два будильника
from functools import lru_cache
def timestr_to_tuple(s):
return tuple(int(x) for x in s.split(':'))
@lru_cache(maxsize=None)
def count(time, newtime):
x = min(abs(newtime[0] - time[0]), abs(newtime[0] + time[0] - 24)) + min(
from random import randint
mylist = [randint(10,20) for x in range(randint(10,15))]
print(*mylist)
even = [x for x in enumerate(mylist) if x[1] % 2 == 0]
for i in zip((x[0] for x in even), sorted(x[1] for x in even)):
mylist[i[0]] = i[1]
print(*mylist)
from pony import orm
db = orm.Database()
orm.set_sql_debug(True)
class Author(db.Entity):
name = orm.PrimaryKey(str)
books = orm.Set('Book')