Skip to content

Instantly share code, notes, and snippets.

View padpadpadpad's full-sized avatar
🙃

Daniel Padfield padpadpadpad

🙃
View GitHub Profile
@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active April 14, 2025 05:39
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }
@mndrake
mndrake / shiny_leaflet_brushing.R
Created March 29, 2017 00:39
Interactive Polygon Brushing with Shiny and Leaflet
# originally from: http://stackoverflow.com/questions/42528400/plot-brushing-or-accessing-drawn-shape-geometry-for-spatial-subsets-in-shiny-lea
# uses https://github.com/bhaskarvk/leaflet.extras
library(shiny)
library(leaflet)
library(leaflet.extras)
library(sp)
cities <- structure(list(AccentCity = c("Saint Petersburg", "Harare", "Qingdao",
"Addis Abeba", "Xian", "Anshan", "Rongcheng", "Kinshasa", "New York",
@ramhiser
ramhiser / brms-nonlinear.r
Last active February 26, 2023 18:14
Adding fixed effects and random effects to a nonlinear Stan model via brms
# The data set and model are described in the *brms* vignette
library(brms)
url <- paste0("https://raw.githubusercontent.com/mages/diesunddas/master/Data/ClarkTriangle.csv")
loss <- read.csv(url)
set.seed(42)
# Generated a random continuous feature
loss$ramey <- runif(nrow(loss))
@wch
wch / lmgadget.R
Created January 20, 2016 18:17
Shiny Gadget example: lmGadget
library(shiny)
# Example usage:
# lmGadget(mtcars, "wt", "mpg")
#
# Returns a list with two items:
# $data: Data with excluded rows removed.
# $model: lm (model) object.
lmGadget <- function(data, xvar, yvar) {
library(miniUI)
@mbostock
mbostock / .block
Last active April 19, 2025 08:19
The Gist to Clone All Gists
license: gpl-3.0
ks.default <- function(rows) seq(2, max(3, rows %/% 4))
many_kmeans <- function(x, ks = ks.default(nrow(x)), ...) {
ldply(seq_along(ks), function(i) {
cl <- kmeans(x, centers = ks[i], ...)
data.frame(obs = seq_len(nrow(x)), i = i, k = ks[i], cluster = cl$cluster)
})
}
all_hclust <- function(x, ks = ks.default(nrow(x)), point.dist = "euclidean", cluster.dist = "ward") {