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 shelve | |
import time | |
def cache(func): | |
def wrapper(*args, **kwargs): | |
with shelve.open('cache.db') as cache_db: | |
cache_key = f"{func.__name__}{args}{kwargs}" | |
if cache_key in cache_db: | |
# Check if data is expired | |
cache_time, cache_data = cache_db[cache_key] |
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
#!/usr/bin/python3 | |
import pymongo | |
import json | |
import asyncio | |
from pyrogram import Client | |
client = pymongo.MongoClient("localhost", 27017) | |
db = client.telegram |
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 { JSDOM } from 'jsdom'; | |
const username = '...'; | |
const number_of_pages = 1 | |
async function parse(url) { | |
let response = await fetch(url) | |
let text = await response.text() | |
const dom = new JSDOM(text) | |
return dom.window; |
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 sys | |
import openpyxl | |
worktime = openpyxl.load_workbook(sys.argv[1]).active | |
absence1 = openpyxl.load_workbook(sys.argv[2]).active | |
absence2 = openpyxl.load_workbook(sys.argv[3]).active | |
people = {} | |
for row in worktime.iter_rows(min_row=2, min_col=1, max_col=6): |
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 caldav | |
def ct(d): | |
return d.strftime("%Y%m%dT%H%M00") | |
class Calendar: | |
def __init__(self, caldav_url, username, password, calendar_name): |
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
document.querySelectorAll('.icon-trash').forEach((r, i) => { | |
setTimeout(() => { | |
r.click(); | |
document.querySelector('.btn-primary').click(); | |
}, i * 2000) | |
}) |
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
#!/bin/bash | |
# Run | |
# chmod +x full_system_backup.sh | |
# touch full_system_backup_exclude | |
# ./full_system_backup.sh SSH_REMOTE | |
btrfs subvolume snapshot -r / /mnt/snapshot | |
mount --bind /boot /mnt/snapshot/boot |
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
#!/usr/bin/python | |
# Prerequisities | |
# pip install pyrogram tgcrypto | |
from datetime import datetime | |
from pyrogram import Client | |
# Configure here |
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
""" | |
This module combines input from CSV file with API endpoint data and outputs | |
result to CSV file. | |
Example: | |
Usage: | |
$ wpe_merge input_csv_file output_csv_file | |
To show help use: |
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 curses | |
import pdb | |
import random | |
import time | |
from curses import wrapper | |
GAME_BOARD_SIZE = (20, 20) |
NewerOlder