Skip to content

Instantly share code, notes, and snippets.

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int LEFT = 4;
const int UP = 2;
const int RIGHT = 6;
const int DOWN = 8;
@SilverEzhik
SilverEzhik / middleclick.c
Created August 31, 2018 02:44
This small program performs a middle click on macOS - stick this in an Automator service and you can get a shortcut to perform a middle click!
#include <ApplicationServices/ApplicationServices.h>
int main() {
// get pointer location
CGEventRef ourEvent = CGEventCreate(NULL);
CGPoint point = CGEventGetLocation(ourEvent);
CFRelease(ourEvent);
// button down
CGEventRef click1_down = CGEventCreateMouseEvent(
@SilverEzhik
SilverEzhik / Twitter instant block.js
Last active October 19, 2018 21:29
Block people on the hell website with one less click
// ==UserScript==
// @name Twitter instant block
// @description Block people on the hell website with one less click
// @include https://twitter.com/*
// @version 1
// @grant none
// ==/UserScript==
// using mozilla sample code
// https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
@SilverEzhik
SilverEzhik / Twitter Lite instant block.js
Last active November 25, 2018 01:51
Block people on the lite version of the hell website with one less click
// ==UserScript==
// @name Twitter Lite instant block
// @description Block people on the hell website with one less click
// @include https://mobile.twitter.com/*
// @version 1
// @grant none
// @run-at document-idle
// ==/UserScript==
// using mozilla sample code
@SilverEzhik
SilverEzhik / Tree Style Tab.css
Created December 27, 2018 21:41
Fancy Side Tabs in Firefox
/* sync animation transitions */
.tab, .favicon, .twisty, .contextual-identity-marker, .newtab-button-box, .label {
transition: all 500ms ease-in-out 400ms, background-color 200ms ease-in-out !important;
}
html:hover .tab, html:hover .favicon, html:hover .twisty, html:hover .newtab-button-box, html:hover .label {
transition: all 400ms ease-in-out, background-color 200ms ease-in-out !important;
}
html:not(:hover) .tab {
margin-left: 0 !important;
@SilverEzhik
SilverEzhik / YouTube full-height theater.css
Last active January 5, 2019 00:37
YouTube full-height theater
:root {
--bar-height: 23px;
--bar-height-orig: 56px;
}
ytd-app[is-watch-page=""] #player-theater-container {
min-height: calc(100vh - var(--bar-height)) !important;
}
ytd-app[is-watch-page=""]:not([masthead-hidden_=""]) #page-manager {
margin-top: var(--bar-height) !important;
}
@SilverEzhik
SilverEzhik / Discourse Enhancer.js
Last active February 12, 2019 05:02
A strange game. The only winning move is not to play.
// ==UserScript==
// @name Discourse Enhancer
// @description A strange game. The only winning move is not to play.
// @version 1
// @run-at document-start
// @grant none
// @include *://*reddit.com/r/all/
// @include *://news.ycombinator.com/item*
@SilverEzhik
SilverEzhik / no.js
Last active February 20, 2019 06:16
write-only twitter
// ==UserScript==
// @name No
// @include *twitter.com/*
// @run-at document-start
// ==/UserScript==
function no() {
var x = window.location;
if (x == "https://twitter.com/home" || x == "https://twitter.com/") {
x.replace("https://twitter.com/dril/status/922321981");
@SilverEzhik
SilverEzhik / Disable YouTube Autoplay.js
Last active April 21, 2019 20:10
YouTube is annoying in persistently switching autoplay back on, probably due to my cookie shennanigans, this fixes that.
// ==UserScript==
// @name Disable YouTube Autoplay
// @version 1
// @grant none
// @include https://*youtube.com/*
// @run-at document-idle
// ==/UserScript==
function fix() {
var a = document.getElementById("toggle");
@SilverEzhik
SilverEzhik / Disable Dark Mode in Firefox.txt
Created July 10, 2019 11:21
If you are using Firefox and a dark theme on your OS, to prevent the prefers-color-scheme media query from making websites go dark, do this.
If you are using Firefox and a dark theme on your OS, to prevent the prefers-color-scheme media query from making websites go dark, do this:
1. Go to about:config
2. Right Click > New > Integer
3. Set it to:
Name - ui.systemUsesDarkTheme
Value - 0
Then restart Firefox.