Skip to content

Instantly share code, notes, and snippets.

View y-top-developer's full-sized avatar

Y y-top-developer

View GitHub Profile
@y-top-developer
y-top-developer / windows_clipboard_changer.py
Last active June 5, 2020 18:41
Changes the clipboard
import win32clipboard
import random
import string
def change():
win32clipboard.OpenClipboard()
data = list(win32clipboard.GetClipboardData())
for i in range(random.randint(0, (len(data) - 1))):
data[random.randint(0, len(data) - 1)] = random.choice(string.ascii_letters + string.digits)
import java.io.*;
import java.nio.file.*;
import java.util.Scanner;
public class IceCreamBytes {
public static void main(String[] args) throws IOException {
Path path = Paths.get("IceCreamManual.txt");
byte[] manualBytes = Files.readAllBytes(path);
// Scanner keyboard = new Scanner(System.in);
@y-top-developer
y-top-developer / replicant.py
Last active June 3, 2020 10:40
Self-recording code. (This program can modify your files, so run carefully)
#start
#MARKER
import os
import sys
original_code = ""
def get_original_code():
global original_code
with open(sys.argv[0]) as file:
original_code = file.read()
@y-top-developer
y-top-developer / testGenerator.py
Created May 29, 2020 13:33
generator test's objects for test bubble sort method
import random
numberOfTests = 30
for i in range(numberOfTests):
randomList = random.sample(range(-100000, 100000), random.randint(10, 30))
test = 'new object[]\n{\n\tnew List<int>() {' + ", ".join(list(map(str, randomList))) + '}, new List<int>() {' + ", ".join((list(map(str, sorted(randomList))))) + '},\n},'
print(test)
@y-top-developer
y-top-developer / prettyPrint.cs
Created May 27, 2020 19:55
pretty tree print method on C#
void PrettyPrint(SyntaxNode node, string indent = "", bool isLast = true)
{
var marker = isLast ? "└──" : "├──";
Console.Write(indent);
Console.Write(marker);
Console.Write(node.Kind);
if (node is SyntaxToken token && token.Value != null)
{
@y-top-developer
y-top-developer / formula.py
Last active May 25, 2020 11:15
parse xml and considers suitable values
import xml.etree.ElementTree as ET
import re
import sympy
tree = ET.parse('sheet1.xml')
root = tree.getroot()
formulas = list()
def get_children(root):