Skip to content

Instantly share code, notes, and snippets.

View Srokap's full-sized avatar

Paweł Sroka Srokap

View GitHub Profile
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@codeb2cc
codeb2cc / gist:6280031
Created August 20, 2013 10:58
Nginx log format and GoAccess configuration.
# Nginx log format
log_format main '$remote_addr\t$remote_user\t$time_local\t$request_time\t$request\t'
'$status\t$body_bytes_sent\t$http_referer\t'
'$http_user_agent\t$http_x_forwarded_for';
# GoAccess configuration
# IMPORTANT: Replace all `\t` below with real tabs
date_format %d/%b/%Y:%T
log_format %h\t%^\t%d %^\t%T\t%r\t%s\t%b\t%R\t%u\t%^
@John07
John07 / HLS_dvr.sh
Last active June 10, 2023 10:40
A small script to make recording http live streams (HLS, those streams that work on iOS devices) nicer on a Mac. Script records the stream for a defined period of time and sends the user notifications if anything goes wrong and once it's done.
# required: ffmpeg (e.g. from homebrew), terminal-notifier from https://github.com/alloy/terminal-notifier
# you can schedule this with launchd to run e.g. weekly
# Specify in seconds how long the script should record (default here is 1 hour).
seconds=3600
# Date format for the recording file name
DATE=`date "+%d-%m-%y_%H-%M"`
# start ffmpeg recording
@thecaddy
thecaddy / childModel.js
Last active September 23, 2021 06:46
A sequelize plugin to support postgres inherited tables with models
//THIS MODEL INHERITS FROM THE OTHER TABLE
import inheritFrom form './inheritFrom'
import inherittedModel from './inherittedModel'
export default function(sequelize, DataTypes) {
const ChildModel = inheritFrom(sequelize, DataTypes)('childModel', inherittedModel, {
// define child model specific properties here
id: Sequelize.INTEGER,
some_model_id: Sequelize.INTEGER
@kekru
kekru / Docker connect to remote server.md
Last active April 15, 2024 16:26
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

@crittermike
crittermike / wget.sh
Last active March 26, 2024 22:49
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.