Skip to content

Instantly share code, notes, and snippets.

View adriantorrie's full-sized avatar

Adrian Torrie adriantorrie

View GitHub Profile
@un33k
un33k / sed cheatsheet
Created August 22, 2011 13:28
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@shawnbot
shawnbot / Makefile
Created August 7, 2013 01:36
Read environment variables from your .env in make tasks.
test:
source .env && echo "my secret key is: $$SECRET_KEY"
@rxaviers
rxaviers / gist:7360908
Last active November 17, 2024 13:31
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@juliaferraioli
juliaferraioli / Julia-on-GCE-2
Created January 23, 2014 08:38
Import data from Google Cloud Storage, save locally, produce png, and save to Google Cloud Storage.
Pkg.add("Gadfly")
Pkg.add("HTTPClient")
Pkg.add("JSON")
Pkg.add("RDatasets")
using Gadfly
using HTTPClient.HTTPC
using JSON
using RDatasets
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
curl --silent https://gist.githubusercontent.com/tingletech/9823267/raw/163e5494fb0f2abe228a959ccd66e8bcb75a7c75/jq.json \
  | jq ".[0].from_user"
"_AaronNg"

It is still quoted, sure, but that has not stopped me from using the output in scripts / xargs.

@tomaskrehlik
tomaskrehlik / gist:ce7ac48a523e7b7a0895
Created August 25, 2014 07:31
Miscellaneous tests for time series.
# Critical values for the Augmented Dickey-Fuller test.
# http://home.cerge-ei.cz/petrz/GDN/crit_values_ADF_KPSS_Perron.pdf
# The p-vals are 0.01, 0.025, 0.05, 0.1
# Number of observations is in the Ts
# Small test only for the df test
# Should print something close to critical value
# using Distributions
# mean([sort([df(cumsum(rand(Normal(), 1000)), "None")[1] for i=1:500])[25] for j=1:200])
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@garystafford
garystafford / helpful-docker-commands.sh
Last active August 9, 2024 16:14
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@devxoul
devxoul / git-tag-semver.sh
Last active November 11, 2019 12:28
Replace git tags to semantic version
#!/bin/bash
# Replace git tags to semantic version
# e.g. v1.0.0 -> 1.0.0
for vtag in $(git tag -l | awk '$0 ~ /^v/')
do
tag=$(echo $vtag | sed -e 's/^v//')
git tag $tag $vtag
git tag -d $vtag
git push origin :refs/tags/v$tag