Skip to content

Instantly share code, notes, and snippets.

View robsalasco's full-sized avatar
🏠
Working from home

Roberto Salas robsalasco

🏠
Working from home
View GitHub Profile
@nadavrot
nadavrot / Matrix.md
Last active May 5, 2024 08:37
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@scf37
scf37 / simulate_scanned_PDF.md
Created April 11, 2018 11:49
Simulate a scanned PDF with ImageMagick

Simulate a scanned PDF with ImageMagick

  1. Download and install Ghostscript and ImageMagick + Convert Module
  2. Execute the following command in the console (change the filename)
$ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf  -quality 85 -compress JPEG -colorspace gray OUTPUT.pdf

Description of the options

  • -density: set the input DPI to 200
  • -rotate: set Page rotation to 0.3 degrees
@CliffordAnderson
CliffordAnderson / 01-introduction.md
Last active April 23, 2024 07:44
Exploring the U-Bahn with Neo4j

Analyzing the U-Bahn Network with Neo4J

The goal of this exercise is to extract information about the Berlin metro system from Wikidata and to analyze its relationships with Neo4j.

Berlin U-Bahn Map

@benmarwick
benmarwick / rotate-axis-labels-ggplot2.R
Last active March 30, 2024 08:00
I can never remember how to rotate the x-axis labels with ggplot2: theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
# Adapted from https://stackoverflow.com/a/7267364/1036500 by Andrie de Vries
# This is it: theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
library(ggplot2)
td <- expand.grid(
hjust=c(0, 0.5, 1),
vjust=c(0, 0.5, 1),
angle=c(0, 45, 90),
library(tidycensus)
library(plotly)
library(ggplot2) # devtools::install_github("tidyverse/ggplot2")
library(crosstalk)
# Set your Census API key with `census_api_key()` if not already installed
tx <- get_acs(geography = "county",
variables = c(pctcollege = "DP02_0067P",
hhincome = "DP03_0062"),
state = "TX",
@JohnMount
JohnMount / confEc2RServer.bash
Last active September 6, 2021 09:49
Configure an Amazon EC2 instance to serve a tunneled RStudio Server instance (from a Unix client)
#!/bin/bash
# on local
pempath="$1"
ec2target="$2"
ssh -T -i "${pempath}" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@${ec2target} << 'EOBLOCK'
# on remote machine
sudo apt-get -y update
sudo apt-get -y upgrade
@pachadotdev
pachadotdev / r_ubuntu_17_10.sh
Last active June 25, 2019 05:43
Install R on Ubuntu 17.10
# Install R
sudo apt-get update
sudo apt-get install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev
# Install RStudio
cd ~/Downloads
wget https://download1.rstudio.org/rstudio-xenial-1.1.383-amd64.deb
sudo gdebi rstudio-xenial-1.1.383-amd64.deb
printf '\nexport QT_STYLE_OVERRIDE=gtk\n' | sudo tee -a ~/.profile
@palin
palin / gist:01ba1feedff6e4d321e86c9c09f47833
Created October 10, 2017 11:33
Connect Luigi with mysql db
import luigi
import luigi.contrib
import luigi.contrib.mysqldb
import MySQLdb
"""
This simple worflow works like this:
1. Read 12 records from reviews table in local revieworld_live DB
2. Insert those 12 records (only review_id and published date) into local luigi_test_1 table in test DB
3. Read 12 records from local luigi_test_1 table in test DB
@zhiyzuo
zhiyzuo / Install-Rattle-on-macOS.md
Last active May 17, 2020 12:17
A brief note on how to install rattle/RGtk2 on macOS
@larsch
larsch / install-arch-linux-rpi-zero-w.sh
Created July 6, 2017 06:05
Install Arch Linux ARM for Raspberry Pi Zero W on SD Card (with commands to configure WiFi before first boot).
#!/bin/sh -exu
dev=$1
cd $(mktemp -d)
function umountboot {
umount boot || true
umount root || true
}
# RPi1/Zero (armv6h):