Skip to content

Instantly share code, notes, and snippets.

View plasmatic1's full-sized avatar
☺️
coder

Moses Xu plasmatic1

☺️
coder
View GitHub Profile
@plasmatic1
plasmatic1 / removeSimplify.js
Last active August 17, 2023 19:46
RemoveSimplify: A GreaseMonkey script that removes URL query parameter values containing the case-insensitive string "simplify", repeating very 5 seconds.
// ==UserScript==
// @name Remove Simplify
// @version 1
// @grant none
// @author Plasmatic (Moses Xu)
// ==/UserScript==
function removeSimplify() {
// Function to remove a specific query parameter from a URL
function removeQueryParamByValueContains(url, param) {
from tkinter import *
from tkinter import ttk
import math
import time
root = Tk()
root.title('BPM Estimator')
root.geometry('300x300')
# math and stuff
// ./difference.yml
#include "bits/stdc++.h"
using namespace std;
// Defines
#define fs first
#define sn second
#define pb push_back
#define eb emplace_back
#define mpr make_pair
@plasmatic1
plasmatic1 / cond.py
Created April 26, 2019 14:33
Conditional Practice
from random import choice, sample, randint
suj = ['Je', 'Tu', 'Il', 'Elle', 'Nous', 'Vous', 'Ils', 'Elles', 'On']
ends = ['ais', 'ais', 'ait', 'ait', 'ions', 'iez', 'aient', 'aient', 'ait']
vb = ['aller', 'avoir', 'être', 'faire', 'pouvoir', 'devoir', 'savoir', 'venir', 'voir', 'vouloir']
pt = ['ir', 'aur', 'ser', 'fer', 'pourr', 'devr', 'saur', 'viendr', 'verr', 'voudr']
assert len(suj) == len(ends)
assert len(vb) == len(pt)
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
@plasmatic1
plasmatic1 / treap.cpp
Last active January 9, 2019 21:59
A Treap Implementation
//============================================================================
// Name : BinarySearchTreeTest.cpp
// Author : Daxi the Taxi
// Version :
// Copyright : ALL YOUR CODE IS BELONG TO US
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <bits/stdc++.h>
@plasmatic1
plasmatic1 / thing.py
Last active December 30, 2018 19:34
evan zhang but with gui
import urllib.request as request
import json
import tkinter
from collections import namedtuple
from bisect import bisect
# This is the code of the contest you want to check
# Change this constant if you want to see the changes from a different contest.
# Note that there is a lack of info on many earlier contests so it's best to try
# on a currently running one.
@plasmatic1
plasmatic1 / BIT.py
Last active December 7, 2018 17:04
Binary Indexed Tree with search function
class BIT:
def __init__(self, leng):
self.length = leng
self.tree = [0] * (leng + 1)
self.arr = [0] * (leng + 1)
self.max_bit = 1
while self.max_bit <= self.length: self.max_bit <<= 1
def sum(self, x):
ttl = 0
@plasmatic1
plasmatic1 / priorityqueue.py
Last active December 9, 2018 05:06
Priority Queue Implementation
import heapq
class PriorityQueue:
def __init__(self, key=None, heap=[]):
self.key = key
self.heap = heapq.heapify(heap) if heap else []
def __bool__(self): return bool(self.heap)
def __len__(self): return len(self.heap)
def __iter__(self):
if self.key: return map(lambda x: x[1], self.heap)
else: return iter(self.heap)
@plasmatic1
plasmatic1 / macros.cpp
Last active September 2, 2019 15:33
Wesley Leung's Monstrous Code Template
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;using namespace std::placeholders;using namespace __gnu_pbds;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second