Skip to content

Instantly share code, notes, and snippets.

@renestalder
renestalder / README.md
Last active May 3, 2024 14:08
Unfollow all on Facebook

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.

@elben
elben / understanding-transducers.clj
Last active February 14, 2021 10:55
Understanding Transducers. See README below.
(ns my-transducers.core
(:require [clojure.core.async :as async]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Understanding Transducers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This is the source code for the blog post Understanding Transducers, found
;; here: http://elbenshira.com/blog/understanding-transducers
;;
@ptaoussanis
ptaoussanis / transducers.clj
Last active December 17, 2021 13:54
Quick recap/commentary: Clojure transducers
(comment ; Fun with transducers, v2
;; Still haven't found a brief + approachable overview of Clojure 1.7's new
;; transducers in the particular way I would have preferred myself - so here goes:
;;;; Definitions
;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as:
(fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation
;; (The `[]` arity is actually optional; it's only used when calling
;; `reduce` w/o an init-accumulator).
(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)
(ns com.thelastcitadel.pipeline
(:require [clojure.core.async :refer
[chan >!! <!! <! close! go thread go-loop]]))
(defn pipeline [things]
{:pre [(or (even? (count things))
(every? #(and (vector? %)
(= 2 (count %))) things))]}
(let [x (->> (if (vector? (first things))
things
@yokolet
yokolet / memo.md
Last active December 28, 2019 15:02
Datomic Pro with PostgreSQL setup
@alandipert
alandipert / warp.clj
Last active December 20, 2015 20:18
(ns tailrecursion.warp
"Conditionals in the exception dimension enabling faster-than-logic (FTL) travel. Based on the Alcubierre drive."
(:import java.util.WeakHashMap)
(:refer-clojure :exclude [cond or]))
(def ^:dynamic *e*)
(def ^:private thrown (WeakHashMap.))
(defmacro throw! [expr]
@devn
devn / useful.clj
Last active December 20, 2015 07:59
I wish these were in clojure.walk.
(ns clojure.walk.useful
(:require [clojure.walk :refer (postwalk)]))
(defn transform-keys
"Recursively transforms all keys in map `m` which return true for
a function `pred` by applying a function `f` to them."
[m pred f]
(let [func (fn [[k v]] (if (pred k) [(f k) v] [k v]))]
(postwalk (fn [x] (if (map? x) (into {} (map func x)) x)) m)))
@avdi
avdi / gol.exs
Last active June 3, 2016 04:30
Game of life in Elixir (take 1)
defmodule Life do
def run(board) when is_binary(board) do
board |> parse_board |> run
end
def run(board) do
IO.write("\e[H\e[2J")
Life.print_board board
:timer.sleep 1000
board = next_board(board)
@stuartsierra
stuartsierra / spellcheck.clj
Created July 9, 2013 01:47
Example implementation of Norvig's Spellchecker in Clojure, using core.async
;; Example implementation of Norvig's Spellchecker in Clojure,
;; using core.async
;;
;; There are probably some bugs in this.
;;
;; Original problem: https://github.com/ericnormand/spelling-jam
;; from Lambda Jam, Chicago, 2013: http://lambdajam.com/
;;
;; Clojure core.async introduction:
;; http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html