Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
{
"rocid": {
"city": [
{
"city_id": "4400",
"country_id": "3159",
"region_id": "4312",
"name": "Москва"
},
{
types = {
3: c1,
5: c2,
7: c3,
9: c4,
14: c5,
}
for f in features:
@aq1
aq1 / map.py
Last active August 31, 2016 16:47
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[]',
@aq1
aq1 / pr.py
Created September 6, 2016 16:58
import os
import sqlite3
# try:
# os.remove('db.sqlite3')
# except FileNotFoundError:
# pass
conn = sqlite3.connect('db.sqlite3')
cursor = conn.cursor()
# 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
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)
@aq1
aq1 / itsg.py
Last active February 13, 2017 22:27
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):
import requests
import random
def get_ip():
return '{}.{}.{}.{}'.format(*[random.randint(1, 255) for _ in range(4)])
for i in range(100):
// ==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) {
@aq1
aq1 / actions.ts
Last active November 22, 2023 21:42
Next Server Action with generic Zod validator
"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>) =>