Skip to content

Instantly share code, notes, and snippets.

@lyndsysimon
lyndsysimon / protonmail_archiver.js
Last active June 10, 2024 19:53 — forked from apazzy/protonmail_archiver.js
Protonmail inbox cleaner
/* Protonmail cleanup scripts
* Works with ProtonMail v4.0.14 as of 2022-01-23
*
* Based on Lyndsy's Protonmail mass archiver:
* https://gist.github.com/lyndsysimon/e6a4a1becaddf09fe02c503793b545d6
*
* Usage:
* - Navigate to your inbox (or another folder/label, presumably)
* - Open your browser's developer tools' Javascript console
* - Paste in this script
@lyndsysimon
lyndsysimon / protonmail_archiver.js
Created July 29, 2020 16:35
Protonmail inbox cleaner
/* Lyndsy's Protonmail mass archiver
*
* This is a simple script that marks all emails in a folder as
* read and archives them.
*
* I wrote it to work against the Protonmail Beta interface:
* https://beta.protonmail.com
*
* Usage:
* - Navigate to your inbox (or another folder, presumably)

Seriously?!

You just clicked a link to a site that appeared to be on ftc.gov, but it wasn't.

You got lucky this time. I'm not a bad guy - or at least, I'm partial to Arfcommers and wouldn't want to cause trouble for you mangificent bastards. You're safe.

Next time, mouse over the link and make sure that the URL is actually what it claims to be. In most browsers, the URL should appear at the bottom left of the screen when

@lyndsysimon
lyndsysimon / keybase.md
Created February 25, 2019 22:23
Keybase proof

Keybase proof

I hereby claim:

  • I am lyndsysimon on github.
  • I am lyndsysimon (https://keybase.io/lyndsysimon) on keybase.
  • I have a public key ASDFr0P2j9lwtB8cDWOcuTZ-G_KoUIXcd8lhH1N3xW6c0Qo

To claim this, I am signing this object:

@lyndsysimon
lyndsysimon / x.rb
Created September 6, 2017 14:29
Ruby object: hashing public attributes
class MyClass
PUBLIC_ATTRS = [ :alpha, :bravo, :charlie ].freeze
attr_reader *PUBLIC_ATTRS
def to_h
PUBLIC_ATTRS.map do |var|
[var, instance_variable_get("@#{var}")]
end.to_h.with_indifferent_access
end
class Foo
attr_reader :alpha
def initialize
@alpha = 1
@bravo = 2
end
end
foo = Foo.new
@lyndsysimon
lyndsysimon / domo_negation_filter.md
Last active March 21, 2017 15:44
Filter Negation using the Domo Analyzer

Problem

Given a list of users and roles, display all users who do not have the admin role.

Existing Behavior

When an aggregation is performed in the card, it happens after the filter is applied. As a result, the row (1, admin) is filtered out, but the row (1, user) is not.

Needed Behavior

@lyndsysimon
lyndsysimon / complex.clj
Created December 1, 2016 17:13
Complex function
(ns user
(:require [clj-time.core :as t]))
(defn- merge-time
[start m]
(apply hash-map (reduce concat (map (fn [x] [x (merge (x m) {:time (/ (t/in-millis (t/interval start (t/now))) 1000)})]) (keys m)))))
(def data {:first {:message "First message"
:success true}
:second {:message "Second message"
@lyndsysimon
lyndsysimon / example.md
Created October 20, 2016 14:05
MySQL Column Normalization

table source

id first_value second_value
0 0 0
1 0 1
2 1 0
3 1 1

desired output

class MyAPINotAvailable < StandardError
attr_accessor :message
def initialize(message)
@message = "Failed to connect to MyAPI: #{message}"
end
end
raise MyAPINotAvailable.new "Could not update Foo"