Skip to content

Instantly share code, notes, and snippets.

View Sneppys's full-sized avatar

Snep Sneppys

View GitHub Profile
@Sneppys
Sneppys / hide-twitter-views.js
Created December 23, 2022 02:46
Hide Twitter Views userscript
// ==UserScript==
// @name Hide Tweet Views
// @version 0.1
// @description Hide view count in twitter timeline
// @author Snep
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
@Sneppys
Sneppys / List.java
Created September 28, 2018 22:20
Java method to list all files inside a directory, and print out with indentation.
public static void walkDirectory(File file) {
int levels = file.getAbsolutePath().length() - file.getAbsolutePath().replace(File.separator, "").length();
try {
Files.walk(file.toPath()).map(Path::toFile).forEach((File f) -> {
int subLevels = f.getAbsolutePath().length() - f.getAbsolutePath().replace(File.separator, "").length()
- levels;
String indent = new String(new char[(subLevels) * 4]).replace('\0', ' ');
System.out.println(indent + f.getName() + (f.isDirectory() ? ":" : ""));
});
} catch (IOException e) {
@Sneppys
Sneppys / terrible_approximation_of_.py
Created March 23, 2017 22:57
Approximates Pi using random number generation
from math import sqrt
from random import randrange
# check if two numbers are coprime (share no common factors other than 1)
def is_coprime(m, n):
for i in range(2, int(sqrt(min(m, n))) + 1):
if (m % i == 0 and n % i == 0):
return False
return True
import discord
import asyncio
#############################################################################
# Configuration #
#############################################################################
# NOTE: you need to install discord.py and have Python 3.5.2
# discord.py: https://github.com/Rapptz/discord.py
# python: https://www.python.org/downloads/ (3.5.2)