Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 main | |
import ( | |
"fmt" | |
"unsafe" | |
) | |
func stringptr(s string) *byte { | |
return unsafe.StringData(s) | |
} |
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
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 |
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
;; 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)) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
''' | |
Программа для нахождения перебором решения задачи о 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), |
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 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) |
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
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( |
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
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) |
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
from pony import orm | |
db = orm.Database() | |
orm.set_sql_debug(True) | |
class Author(db.Entity): | |
name = orm.PrimaryKey(str) | |
books = orm.Set('Book') |
NewerOlder