Skip to content

Instantly share code, notes, and snippets.

View fubits1's full-sized avatar
🦄
Unicorning

Ilja fubits1

🦄
Unicorning
View GitHub Profile
@fubits1
fubits1 / ubuntu-bloat-removal.sh
Created March 22, 2024 16:04 — forked from NickSeagull/ubuntu-bloat-removal.sh
Updated Jan 22nd, 2024 - Simple command to remove all "bloatware" from ubuntu
sudo apt-get remove \
aisleriot \
brltty \
duplicity \
empathy \
empathy-common \
example-content \
gnome-accessibility-themes \
gnome-contacts \
gnome-mahjongg \
(function(f,h){typeof exports=="object"&&typeof module<"u"?module.exports=h():typeof define=="function"&&define.amd?define(h):(f=typeof globalThis<"u"?globalThis:f||self,f.Counter=h())})(this,function(){"use strict";function f(){}function h(t){return t()}function T(){return Object.create(null)}function p(t){t.forEach(h)}function N(t){return typeof t=="function"}function O(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Q(t){return Object.keys(t).length===0}function a(t,e){t.appendChild(e)}function P(t,e,n){t.insertBefore(e,n||null)}function V(t){t.parentNode.removeChild(t)}function m(t){return document.createElement(t)}function k(t){return document.createTextNode(t)}function S(){return k(" ")}function L(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}function b(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function R(t){return Array.from(t.childNodes)}function U(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function B(t,e,
@fubits1
fubits1 / copyToClipboard.js
Last active August 22, 2022 18:15
Quarto: different approaches to have a button to trigger a JavaScript function. Use case here: copy the output from a code chunk to the clipboard; SETUP: put the .qmd and the .js files in the same folder
function copyToClipboard(domRef) {
// get DOM Element which contains the output
// i.e. ".cell-output code" to the first output chunk
const dom = document.querySelector(domRef);
// get the clean inner string of the DOM Element (no HTML)
const innerText = dom.innerText;
// with RegEx, remove [nr] and "
const cleanString = innerText.replace(/\[\d+]\s/, '').replace(/"/g, "")
// write to clipboard
navigator.clipboard.writeText(cleanString);
@fubits1
fubits1 / countries.sql
Last active August 13, 2022 12:52
SQL to create a table of country names, ISO codes, and continents (ENUM)
create type public.continents as enum (
'Africa',
'Antarctica',
'Asia',
'Europe',
'Oceania',
'North America',
'South America'
);
create table public.countries (

Keybase proof

I hereby claim:

  • I am fubits1 on github.
  • I am fubits (https://keybase.io/fubits) on keybase.
  • I have a public key ASCBPqZQmVjZKFDJNPD92EEVEXLzZow-57iZx-4msM15dgo

To claim this, I am signing this object:

@fubits1
fubits1 / annotate-jpg.sh
Created April 11, 2022 13:51
Mass-add metadata to JPGs / annotate with alternative descriptions, copyright etc
#!/bin/bash
## libraries: sed, exiftool
# sudo apt-get install sed libimage-exiftool-perl
## if output folder is needed
# [ -d output-folder ] || mkdir output-folder # checks if output folder exists, and create if not
i=0 # to track iteration cycle for lookup by row in text file with sed
## for each JPG
for filename in source-folder/*.jpg; do
((i++))
## lookup row i in text file
@fubits1
fubits1 / single-axis-label-annotated.R
Last active October 27, 2021 20:02
ggplot2 hack: annotate a single axis-label and preserve intendation
library(tidyverse)
annotation <-"HP"
# identify max char length of y-label
ymax_chr <- nchar(as.integer(max(mtcars$hp)))
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(color = "black", alpha = 0.5) +
scale_y_continuous(
@fubits1
fubits1 / mapview_sync.Rmd
Created February 27, 2019 14:57
R Mapview Sync
---
title: "R Notebook"
output: html_document
---
```{r echo=FALSE, warning=FALSE, message=FALSE}
library(tidyverse)
library(leaflet)
library(mapview)
library(sf)
@fubits1
fubits1 / gridsvg-example-barchart.r
Created January 5, 2019 13:52 — forked from jimjam-slam/gridsvg-example-barchart.r
How to add SVG attributes to a ggplot to assist in building interactives for the web
# gridSVG::grid.garnish can be used to add SVG attributes to elements of a plot!
# we don't even need to do it one at a time: with the option `group = FALSE`, we
# can give it a vector of values for an attribute and garnish an entire geom at
# once. the only rub is that sometimes ggplot2 shuffles your data around when
# plotting it. we need to check how the data was reordered, and arrange our
# original data to match, before we send it to grid.garnish.
library(tidyverse)
library(magrittr)
library(grid)
library("roomba")
json_jsonlite <- jsonlite::fromJSON("data.json",
simplifyVector = FALSE,
simplifyDataFrame = FALSE,
simplifyMatrix = FALSE)
json_roomba <- roomba(json_jsonlite$data, cols = "values")
library(tidyverse)
json_roomba %>% str_split(",")
#jsonlite atomic level