Skip to content

Instantly share code, notes, and snippets.

View fubits1's full-sized avatar
🦄
Unicorning

Ilja fubits1

🦄
Unicorning
View GitHub Profile
library(dplyr)
library(arrow)
library(duckdb)
# install.packages(c("dplyr", "arrpw", "duckdb", "nycflights13"))
## Export the nycflights13 dataset to arrow format ----
nycflights13::flights |>
@sdesalas
sdesalas / Async.gs
Last active May 9, 2024 07:02
Asynchronous execution for Google App Scripts (gas)
/*
* Async.gs
*
* Manages asyncronous execution via time-based triggers.
*
* Note that execution normally takes 30-60s due to scheduling of the trigger.
*
* @see https://developers.google.com/apps-script/reference/script/clock-trigger-builder.html
*/
@jimjam-slam
jimjam-slam / gridsvg-example-barchart.r
Last active January 19, 2024 15:00
How to add SVG attributes to a ggplot to assist in building interactives for the web #rstatstips
# 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)
@quadrismegistus
quadrismegistus / gensim_word2vec_measure_semantic_shift_by_local_neighborhood.py
Last active January 24, 2023 14:52
This function measures the amount of semantic shift of a given word between two gensim word2vec models. It is a basic implementation of William Hamilton (@williamleif) et al's measure of semantic change proposed in their paper "Cultural Shift or Linguistic Drift?" (https://arxiv.org/abs/1606.02821), which they call the "local neighborhood measure."
def measure_semantic_shift_by_neighborhood(model1,model2,word,k=25,verbose=False):
"""
Basic implementation of William Hamilton (@williamleif) et al's measure of semantic change
proposed in their paper "Cultural Shift or Linguistic Drift?" (https://arxiv.org/abs/1606.02821),
which they call the "local neighborhood measure." They find this measure better suited to understand
the semantic change of nouns owing to "cultural shift," or changes in meaning "local" to that word,
rather than global changes in language ("linguistic drift") use that are better suited to a
Procrustes-alignment method (also described in the same paper.)
Arguments are:
@NickSeagull
NickSeagull / ubuntu-bloat-removal.sh
Last active July 13, 2024 23:57
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 \
@emeeks
emeeks / README.md
Last active March 25, 2024 07:56 — forked from mbostock/.block
An online tool for interactive teaching of network visualization and representation principles.

The range sliders at the top change the values for the force-directed algorithm and the buttons load new graphs and apply various techniques. This will hopefully serve as a tool for teaching network analysis and visualization principles during my Gephi courses and general Networks in the Humanities presentations.

Notice this includes a pretty straightforward way to load CSV node and edge lists as exported from Gephi.

It also includes a pathfinding algorithm built for the standard data structure of force-directed networks in D3. This requires the addition of .id attributes for the nodes, however.

Now with Clustering Coefficients!

Also, it loads images for nodes but the images are not in the gist. The code also refers to different network types but the data files on Gist only refer to the transportation network.