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
import curses | |
import os | |
import random | |
import sys | |
def get_cell(row_index: int, column_index: int, player: tuple[int, int], target: tuple[int, int]): | |
if player == (row_index, column_index): | |
return '¤' | |
if target == (row_index, column_index): |
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
import { cookies } from "next/headers" | |
import { db } from "~/server/db/client" | |
import { procedureFactory } from "~/server/rpc/procedureFactory" | |
import { z } from "zod" | |
const getAuthContext = async () => { | |
const cookie = cookies().get("auth") | |
if (!cookie) { | |
return { user: null } | |
} |
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 server"; | |
// inspired by tRPC | |
import z from "zod"; | |
const action = <T>(schema: z.Schema<T>) => { | |
return { | |
do: | |
<R>(callback: ({ data }: { data: T }) => Promise<R>) => |
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
// ==UserScript== | |
// @name Remove ads | |
// @namespace whatevernamespace | |
// @include https://vk.com/ | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
var removeAdds = function () { | |
var adsLeft = document.getElementById('ads_left'); | |
if (adsLeft) { |
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
import requests | |
import random | |
def get_ip(): | |
return '{}.{}.{}.{}'.format(*[random.randint(1, 255) for _ in range(4)]) | |
for i in range(100): |
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
import os | |
from datetime import datetime | |
from twisted.names.client import lookupPointer | |
from twisted.web.server import Site | |
from twisted.web.resource import Resource | |
from twisted.internet import reactor, utils | |
class View(Resource): |
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
for i in db.SESSION.query(db.Item).all(): | |
for t in db.SESSION.query(db.Template).filter_by(item_id=i.id): | |
self._show(i, t) | |
self.save(event=None) |
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
# Game of life | |
# Dead cell comes alive only if 3 neighbor cells are alive | |
# Live cell stays alive only if there are 2 or 3 live neighbor cells, else it dies | |
# dynamic grid size | |
from tkinter import * | |
from tkinter import font | |
import time | |
import random | |
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
import os | |
import sqlite3 | |
# try: | |
# os.remove('db.sqlite3') | |
# except FileNotFoundError: | |
# pass | |
conn = sqlite3.connect('db.sqlite3') | |
cursor = conn.cursor() |
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
map_ = {'ginekologiia': {'GI_DIAMETER': 'ginekologiia[]', | |
'GI_ENDOM': 'ginekologiia[]', | |
'GI_LENGTH_1': 'ginekologiia[]', | |
'GI_LENGTH_2': 'ginekologiia[]', | |
'GI_LENGTH_3': 'ginekologiia[]', | |
'GI_LENGTH_4': 'ginekologiia[]', | |
'GI_THICKNESS_1': 'ginekologiia[]', | |
'GI_THICKNESS_3': 'ginekologiia[]', | |
'GI_THICKNESS_4': 'ginekologiia[]', | |
'GI_VOLUME_1': 'ginekologiia[]', |
NewerOlder