Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
Dem keyboards don't go click click on their own you know

Alec Clews alecthegeek

🤖
Dem keyboards don't go click click on their own you know
View GitHub Profile
@BretFisher
BretFisher / Dockerfile
Last active Dec 9, 2021
Multi-stage Dockerfile example of installing dependencies with COPY --from
View Dockerfile
# any images you use later, add them here first to create aliases
# I like keeping all my versions at the top
FROM node:14.3-slim as node
FROM php:7.2.1-fpm-slim as php
FROM nginx:1.17 as nginx
# The real base image to start from
FROM ubuntu:focal-20210827 as base
# install apt stuff
@gvenzl
gvenzl / One Liner to download the latest release from your GitHub repo.md
Last active Jun 11, 2021
One Liner to download the latest release from your GitHub repo
View One Liner to download the latest release from your GitHub repo.md
LOCATION=$(curl -s https://api.github.com/repos/<YOUR ORGANIZTION>/<YOUR REPO>/releases/latest \
| grep "tag_name" \
| awk '{print "https://github.com/<YOUR ORGANIZATION>/<YOUR REPO>/archive/" substr($2, 2, length($2)-3) ".zip"}') \
; curl -L -o <OUTPUT FILE NAME> $LOCATION

for example:

LOCATION=$(curl -s https://api.github.com/repos/gvenzl/csv2db/releases/latest \
| grep "tag_name" \
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active Jan 15, 2022
One Liner to Download the Latest Release from Github Repo
View One Liner to Download the Latest Release from Github Repo.md
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@nf
nf / vm-setup.sh
Last active Aug 12, 2021
Script for setting up Debian Jessie VM with my development environment
View vm-setup.sh
#!/bin/bash -e
echo '
PATH=$HOME/go/bin:$PATH
export GOPATH=$HOME
export CDPATH=.:$HOME/src/golang.org/x:$HOME/go/src:$HOME/src/github.com:$HOME/src/github.com/nf:$HOME/src/github.com/adg
export EDITOR=vim
' >> ~/.profile
sudo apt-get update
@ajfisher
ajfisher / _readme.md
Last active Mar 2, 2021
Auto WiFi detection and hotspot creation in boot for RPI
View _readme.md

Auto WiFi detection or wifi hostpot creation during boot for RPI

Note: These are rough notes and there may be some variance as versions of raspbian get updated but should be pretty reliable as a guide.

This gist provides some instructions and config in order to have your Raspberry PI automatically connect to a roamed network, however if it fails to discover an available network it will set itself up as a wireless access point for you to connect to.

@lizrice
lizrice / fabfile.py
Created Aug 7, 2014
Fab file for connecting and disconnecting to Raspberry PI
View fabfile.py
from __future__ import with_statement
from fabric.api import local, lcd
# Usage:
# fab connect - mounts /home/pi/<pi_dir> so it's available locally at <workspace><remote>
# fab disconnect - unmount
#
# Note this is Mac specific - Linux distributions use fusermount -u instead of umount
# Requires OSXFUSE and SSHFS from http://osxfuse.github.io/
@wolfeidau
wolfeidau / main.yml
Created Dec 16, 2013
NodeJS ansible task roles/nodejs/tasks/main.yml
View main.yml
- name: Install PPA for latest nodejs version
apt_repository: repo=ppa:chris-lea/node.js state=present
tags: install_nodejs_ppa
- name: Install Nodejs package
apt: pkg=nodejs state=latest update_cache=yes
tags: install_nodejs
- name: Install global tools
command: npm install {{ item }} -g
@selenamarie
selenamarie / a_better_opml.py
Last active Dec 11, 2015
This grabs URLs associated with the people you follow on Twitter and then tries to scrape RSS feeds from the URLs. You have to get OAUTH creds from dev.twitter.com/apps to do this, and then register the script so that you get the access_token + access_token_secret. Rev 2 actually produces valid OPML. ;)
View a_better_opml.py
#!/usr/bin/env python
import tweepy
from BeautifulSoup import BeautifulSoup as parser
import urllib
import sys
import argparse
import ConfigParser
@elimisteve
elimisteve / goroutines2.go
Created Jan 3, 2013
Programming Challenge: Launch 4 threads, goroutines, coroutines, or whatever your language uses for concurrency, in addition to the main thread. In the first 3, add numbers together (see sample code below) and pass the results to the 4th thread. That 4th thread should receive the 3 results, add the numbers together, format the results as a strin…
View goroutines2.go
// Steve Phillips / elimisteve
// 2013.01.03
package main
import "fmt"
// intDoubler doubles the given int, then sends it through the given channel
func intDoubler(ch chan int, n int) {
ch <- n*2
@clintel
clintel / gist:1155906
Created Aug 19, 2011
Fenced code in bullet lists with GitHub-flavoured MarkDown??
View gist:1155906

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code