Skip to content

Instantly share code, notes, and snippets.

View eioo's full-sized avatar
👨‍💻
­onpas

Kalle eioo

👨‍💻
­onpas
  • Finland
View GitHub Profile
@eioo
eioo / split_at_newline.py
Last active October 27, 2021 20:59
Split string into chunks that have max size and use new line as seperator
def split_at_newline(text, max_chars=4300):
rows = text.split('\n')
char_count = 0
messages = []
current_msg = ''
for text in rows:
new_char_count = char_count + len(text)
current_msg += text + '\n'
def tulostaLuvunKertoma(n: int) -> None:
print(f'{n}! = {laskeKertoma(n)}')
def lueKokonaisluku() -> int:
return int(input('Anna kokonaisluku: '))
def laskeKertoma(n: int) -> int:
factorial = 1
import collections
import json
chat_name = ''
from_name = ''
with open('result.json', 'r', encoding='utf8') as f:
content = f.read()
data = json.loads(content)
@eioo
eioo / autoexec.cfg
Last active September 3, 2019 08:33
//
// Kallen autoexec.cfg
// Launch options: -novid -tickrate 128 -high
//
// Crosshair
cl_crosshairsize 2.5
cl_crosshairgap -3
cl_crosshairalpha 225
@eioo
eioo / keyboard.v
Last active August 17, 2019 01:36
module vrobot
/* This is C's INPUT struct
typedef struct tagINPUT {
DWORD type;
union {
MOUSEINPUT mi;
KEYBDINPUT ki;
HARDWAREINPUT hi;
import os
import queue
import sys
import threading
import requests
from colorama import Fore, init
script_path = os.path.dirname(os.path.realpath(__file__))
accs_file = os.path.join(script_path, 'accs.txt')
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
using namespace std;
uintptr_t GetModuleBaseAddress(DWORD procId, const wchar_t* modName);
void quit(const string& message);
int main() {
const timeEl = document.createElement('div');
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
const size = 300;
const r = (size / 2) * 0.9;
canvas.style.border = '1px solid gray';
canvas.width = size;
canvas.height = size;
class Solution:
def simplifyPath(self, path: str) -> str:
current_path = []
path = path.replace('//', '/')
parts = list(filter(None, path.split('/')))
for part in parts:
if part == '.':
continue
elif part == '..':
type MessageHandler = (data: any) => void;
interface IMessageHandlers {
[type: string]: MessageHandler[];
};
class SocketWrapper {
ws: WebSocket;
messageHandlers: IMessageHandlers;