Skip to content

Instantly share code, notes, and snippets.

@getjump
getjump / runner.go
Last active June 23, 2022 11:19
Golang Particle Swarm Optimization runner for FreeFEM
package main
import (
"bytes"
"context"
"fmt"
"log"
"math"
"math/rand"
"os"
<?php
class UserOrder
{
public $id;
/** @var string */
public $contactName;
/** @var string */
public $phone;
/** @var string ISO 3166-1 alpha-2 */
public $country;
@getjump
getjump / twitch_predictions.ts
Created November 2, 2021 09:18
Allows to manipulate predictions via chat commands (was done when there were no api interface, mostly broken)
import puppeteer from 'puppeteer';
const fs = require('fs').promises;
const {promisify} = require('util')
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
import aiohttp
import asyncio
import logging
import time
from pyppeteer import launch
from urllib.parse import urlparse, parse_qs
from bs4 import BeautifulSoup
@getjump
getjump / test_unserializer.py
Created November 2, 2021 01:15
Python Unserializer
"""Tests for hello function."""
import pytest
from rostelecom_key.unserializer import JsonUnserializer, DatetimeFormat
from typing import Optional, List, Union
import datetime
from enum import Enum
@getjump
getjump / strace.log
Created October 30, 2021 02:12
Hardware Accelerated Video Decoding on Wayland, Nvidia 495.44 strace + Core Dump
execve("/sbin/vainfo", ["vainfo"], 0x7fffa7997090 /* 47 vars */) = 0
brk(NULL) = 0x5640b656c000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd508416c0) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=144684, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 144684, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6e6e530000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libva.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\0\0\0\0\0\0"..., 832) = 832
package main
import (
"fmt"
"net/http"
"runtime"
"sort"
"sync"
"time"
)
const http = require('http');
const { Sema } = require('async-sema');
const REPEAT_COUNT = 100;
const s = new Sema(500, {
capacity: 100000000
});
@getjump
getjump / fefu-ical-parser.js
Created September 22, 2019 04:24
Экспортирует расписание с личного кабинета ДВФУ в iCal для дальнейшего импорта например в Google Calendar
// ЗАПУСКАТЬ ОТСЮДА: https://univer.dvfu.ru/schedule
// Проверено на работоспособность в Firefox
// Копировать в консоль, сохранить файл, импортировать например в Google Calendar
(async function() {
var semesterStart = '2019-09-23';
var semesterEnd = '2020-01-03';
// Function to download data to a file
var data = [];
var job = function() {
$('span.title a').each(function(i, x) { data.push({name: x.innerText, link: $(x).attr('href'), vimeoId: '' })})
var w = window.open();
var i = 0;
var vimeoId = null;