Skip to content

Instantly share code, notes, and snippets.

@greduan
greduan / uBlock Origin YouTube procrastination filters.txt
Created February 9, 2023 07:41
Blocks the YouTube video suggestions, main page, and subscriptions page, to break the procrastination flow. You now have to open a specific video to be able to watch it.
! 2022-12-06 https://www.youtube.com
www.youtube.com###related
! 2022-12-20 https://www.youtube.com
www.youtube.com###primary > .ytd-two-column-browse-results-renderer.style-scope
@greduan
greduan / Makefile
Last active April 7, 2018 19:29
Java Makefile
class_d=bin
lib_d=lib
source_d=src
JAVAC=javac
JFLAGS=-g -d $(class_d) -sourcepath $(source_d) -Xlint:all
s_app=$(shell find $(source_d) -name '*.java')
c_app=$(patsubst $(source_d)/%.java, $(class_d)/%.class, $(s_app))
@greduan
greduan / handlebarsRender.js
Created February 3, 2018 17:17
A synchronous, minimal render()-generating function for use with Express or Koa (or whatever)
const fs = require('fs')
const path = require('path')
const Handlebars = require('handlebars')
const generateHandlebarsTemplate =
templateSource => Handlebars.compile(templateSource);
module.exports = viewsPath => {
const files = fs.readdirSync(viewsPath)
@greduan
greduan / basic-server.js
Created September 13, 2017 20:12
Just a starter server that I've seen myself writing several times now
const path = require('path')
const express = require('express')
const morgan = require('morgan')
const app = express()
app.set('x-powered-by', false)
app.set('view engine', 'ejs')
app.set('views', path.resolve(__dirname, '..', 'views'))
@greduan
greduan / unsub-youtube.js
Created September 11, 2017 21:24
Mass unsub from all YT subscriptions
const buttons = document.getElementsByClassName('subscribed-label')
Array.prototype.forEach.call(buttons, b => {
b.click()
const unsub = document.getElementsByClassName('overlay-confirmation-unsubscribe-button')
Array.prototype.forEach.call(unsub, u => u.click())
})

Keybase proof

I hereby claim:

  • I am greduan on github.
  • I am greduan (https://keybase.io/greduan) on keybase.
  • I have a public key whose fingerprint is 2F24 E29B 1BE2 A929 5A81 9EDE 99C9 826C 54CF DECB

To claim this, I am signing this object:

'use strict'
var Promise = require('bluebird'),
ttys = require('ttys'),
readlineSync = require('readline-sync')
module.exports = function () {
return Promise.resolve(readlineSync.question('password: ', { hideEchoBack: true }))
}
@greduan
greduan / init.js
Created March 9, 2016 03:22
Atom: Destroy other items in pane when we open a new item
// We don't need empty panes
if (atom.config.get('core.destroyEmptyPanes')) {
atom.config.set('core.destroyEmptyPanes', true)
}
atom.workspace.onDidOpen(function (event) {
/**
* event = { item, pane, index }
*/
var uuid = require('node-uuid')
var M = {}
M.BaseModel = Class(M, 'BaseModel').inherits(Krypton.Model)({
primaryKey: 'uuid',
prototype: {
init: function (config) {
@greduan
greduan / time-estimate
Last active January 5, 2016 00:55
Script to figure out how long you'll take on a ticket, worst case, expected case and best case are provided
#!/usr/bin/env node
if (process.argv.length < 5) {
console.log('usage: time-estimate BEST EXPECTED WORST')
process.exit(0)
}
var best = parseFloat(process.argv[2]),
exp = parseFloat(process.argv[3]),
worst = parseFloat(process.argv[4]),