Skip to content

Instantly share code, notes, and snippets.

View johnniehard's full-sized avatar
🚀
Making it happen!

Johnnie Hård johnniehard

🚀
Making it happen!
View GitHub Profile
@ctufts
ctufts / group_by_and_ggplot.R
Created July 11, 2016 19:56
dplyr group_by and ggplot example
plot_df <-df %>% group_by(feature) %>%
do(
plots = ggplot(data = .) + aes(x = xcol, y = ycol) +
geom_point() + ggtitle(.$feature)
)
# show plots
plot_df$plots
@billautomata
billautomata / ssh_tunnels.sh
Last active May 15, 2024 13:22
ssh port forwarding cheatsheet
# local port forwarding
# the target host 192.168.0.100 is running a service on port 8888
# and you want that service available on the localhost port 7777
ssh -L 7777:localhost:8888 user@192.168.0.100
# remote port forwarding
# you are running a service on localhost port 9999
# and you want that service available on the target host 192.168.0.100 port 12340
@OguzPastirmaci
OguzPastirmaci / start-stop-azure-vms.sh
Last active September 7, 2017 09:17
Bash script that shows a menu to start or stop VMs using Azure cross-platfom CLI
#!/bin/bash
clear
echo ""
echo "-----------------------------------"
echo ""
echo "WHAT DO YOU WANT TO DO TODAY?"
echo ""
echo "1 - Start all the VMs"
echo "2 - Shutdown all the VMs"
@ajaegers
ajaegers / git-move-files-in-subfolder.md
Last active February 17, 2024 13:28
Git: move files in an subfolder keeping history

Change structure of project folder with Git

I have this structure:

 project-folder/
     .git
     wp-admin/
     wp-content/
     wp-includes/

.htaccess

@jqtrde
jqtrde / modern-geospatial-python.md
Last active August 1, 2023 14:50
Modern remote sensing image processing with Python
@guitar1999
guitar1999 / qgis_postgis_geom.py
Last active February 27, 2017 09:45
QGIS 2.2 and PostGIS geometry > 2d
# QGIS 2.2 won't show 4d geometry (maybe not 3dm or 3dz either but I didn't test).
# If you don't actually need 4d and it's just an artifact of the data when you loaded
# it, use this python snippet to convert it to 2d and get your data showing up in
# QGIS again. Use at your own risk. There is NO ERROR HANDLING HERE!
import psycopg2
db = psycopg2.connect(host='localhost', port='5432', database='#####',user='#####')
cursor = db.cursor()
@vectorsize
vectorsize / linearScale.js
Last active December 20, 2022 14:30
Quick linear scale inspired by d3.js scales, based on the processing.org map() function.takes in an object with a domain array and a rage array, gives you back a function that receives a value and returns the scaled value.
// based on https://github.com/processing/processing/blob/a6e0e227a948e7e2dc042c04504d6f5b8cf0c1a6/core/src/processing/core/PApplet.java#L5093
var scale = function(opts){
var istart = opts.domain[0],
istop = opts.domain[1],
ostart = opts.range[0],
ostop = opts.range[1];
return function scale(value) {
return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));
@michaelt
michaelt / latex.template
Created June 9, 2011 21:23
Simple Pandoc latex.template with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% This ^^^ is a standard LaTeX document class declaration
% (the previous line is a pseudo-comment, declaring that we will
% use the special XeTeX machinery for its more extensive font list
% and its use of unicode.)
% If you made this line more akin to the one in the default
% latex.template file, say:
% \documentclass$if(fontsize)$[$fontsize$]$endif${scrartcl}