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
// BUILD_ARGS: -Wall $(pkg-config --libs --cflags sdl2) | |
#include <SDL2/SDL.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <unistd.h> | |
#define SCREEN_WIDTH 400 |
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
// Function to extract the username from the follower element | |
const get_username = (follower) => { | |
return new URL( | |
follower.children[1].querySelector("a").href | |
).pathname.substring(1); | |
}; | |
// Function to extract the user ID from the button within the follower element | |
const get_user_id = (follower) => { | |
return follower.querySelector("button").dataset.testid.split("-")[0]; |
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
String.prototype.format = String.prototype.format || | |
function () { | |
"use strict"; | |
var str = this.toString(); | |
if (arguments.length) { | |
var t = typeof arguments[0]; | |
var key; | |
var args = ("string" === t || "number" === t) ? Array.prototype.slice.call(arguments) : arguments[0]; | |
for (key in args) { |
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
""" | |
Convert csv to text or srt like Premiere tracscript wants | |
""" | |
import csv | |
def convert_csv_to_text(csv_filename, text_filename): | |
with open(csv_filename, 'r') as csv_file, open(text_filename, 'w') as text_file: | |
csv_reader = csv.reader(csv_file) | |
next(csv_reader) # Skip the header row | |
for row in csv_reader: |
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
const r = effect("Radius")("Slider"); | |
const progress = Math.max(Math.min(effect("Completion")("Slider"), 1), 0); | |
const ratio = 0.551915024494; | |
const t = r*ratio; | |
const points = [[r,0],[0,r],[-r,0],[0,-r],[r,0]]; | |
const inTangents = [[0,t],[-t,0],[0,-t],[t,0],[0,0]]; | |
const outTangents = [[0,0],[t,0],[0,t],[-t,0],[0,-t]]; |
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
const sleep = ms => new Promise(r => setTimeout(r, ms)); | |
async function animateScroll(dest, easeAmt) { | |
window.scroll(0,0); | |
let easeIn = (p) => p < 0.5 ? Math.pow(p*2, easeAmt)/2 : p; | |
let easeOut = (p) => p > 0.5 ? (2 - Math.pow(2 - p*2, easeAmt))/2 : p; | |
await sleep(1000); | |
for (let i = 0; i < 1; i+=0.001) { | |
let progress = easeIn(easeOut(i)); | |
window.scroll(0, dest*progress); |
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
// Step 1: Export doc as HTML | |
// Step 2: open html in browser | |
// Step 3: run this script in developer console | |
// Step 4: copy res object, convert it to csv or use as is | |
// It could (and should) be easily converted to python script | |
const REGEX = { | |
"links": /https?:\/\/(?:www\.)?(?:[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b)*(?:\/[\/\d\w\.-]*)*(?:[\?])*(?:[-\w.\/:}{=?!@#$%^&*()_+<>]+)/gmi, | |
"timecodes": /(?:\d?\d[:\-–—]\d\d) ?[\-–—]? ?(?:\d?\d[:\-–—]\d\d)?(?: ?[+:\-–—] ?(?:\d?\d[:\-–—]\d\d) ?[\-–—]? ?(?:\d?\d[:\-–—]\d\d)?)?/gi, | |
}; |
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
#!/bin/sh | |
cd ~/<work_dir_here> | |
script=main.py | |
pid=$(ps auxwww | grep $script | grep -v grep | awk '{print $2}') | |
kill -9 $pid | |
pip install -r requirements.txt | |
nohup python -u $script > script.log 2>&1 & |
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
let comments = document.querySelectorAll('[role="article"]'); | |
let result = ""; | |
for (let i = 1; i < comments.length-2; i++) { | |
let data = comments[i].querySelectorAll('span'); | |
result = result + `${i}, \"Name: ${data[5].textContent}\", \"Comment(can be broken): ${data[6].textContent}\",\"Full text: ${data.textContent}\"\n`; | |
} | |
console.log(result); |
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
let regex = /(?<=Ma=\[).+(?=\]\,Oa)/gm, | |
alphabet = {}, | |
wordsList = [], | |
weights = {}; | |
// Каждый день у игры новый хэш, его легко достать из объекта window, | |
// затем в тексте файла нужно найти переменную со списком слов | |
// и превратить ее из текста в массив | |
fetch(`main.${window.wordle.hash}.js`) | |
.then(response => response.text()) |
NewerOlder