Skip to content

Instantly share code, notes, and snippets.

View dewey's full-sized avatar
👋
Click here to edit status

Philipp Defner dewey

👋
Click here to edit status
View GitHub Profile
@gregburek
gregburek / ThinkUp on EC2 Ubuntu User-Data Script
Created July 27, 2011 23:14 — forked from waxpancake/ThinkUp on EC2 Ubuntu User-Data Script
Install script for non-interactively installing ThinkUp and prerequisites
#!/bin/bash -ex
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
# install ThinkUp on EC2 Ubuntu instance:
#
# @spara 12/23/10
# @waxpancake 1/3/11
# install required packages
sudo apt-get update
@averagehuman
averagehuman / postgres-docker-config.sh
Last active April 3, 2019 22:36
Run postgres on docker host, connect from docker containers
#!/bin/bash
################################################################################
# Rather than run postgres in its own container, we want to run it on
# the (Ubuntu) host and allow:
#
# + peer connections on the host
# + local md5 connections from any docker container
#
# THIS IS COPY/PASTED FROM COMMAND LINE INPUT AND IS UNTESTED AS A SINGLE SCRIPT
################################################################################
@alexedwards
alexedwards / main.go
Created January 28, 2018 11:32
RequireLogin middleware
var sessionManager = scs.NewCookieManager("...")
func RequireLogin(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
session := sessionManager.Load(r)
userID, err := session.GetInt("userID")
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
@codingjester
codingjester / oauth_tumblr.py
Created April 3, 2012 23:33
OAuth Tumblr Getting Access Tokens
import urlparse
import oauth2 as oauth
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'
@peta
peta / fm4-grabber.rb
Last active June 25, 2020 20:25
Die Jungs von ORF/FM4/APA haben offenbar den Publishingworkflow und die Integration der FM4oD Mitschnitte auf fm4.orf.at überarbeitet -- und somit mein altbewährtes Grabber-Bashskript unbrauchbar gemacht. Die neue Lösung ist etwas komplexer, weswegen ich das Skript auch mit Ruby anstatt Bash umgesetzt habe, aber funktioniert dennoch gewohnt zuve…
#!/usr/bin/env ruby
# encoding: UTF-8
require 'uri'
require 'open-uri'
require 'json'
require 'nokogiri'
class PodcastGrabber
ROM ruby:2.2.3
RUN apt-get update -qq && apt-get install -y build-essential
RUN apt-get install -y libpq-dev
RUN apt-get install -y ghostscript
RUN mkdir /app
WORKDIR /app
@ts95
ts95 / ScreenshotDetector.swift
Last active February 14, 2022 19:49
OS X detect new screenshot event with Swift
import Foundation
typealias NewFileCallback = (fileURL: NSURL) -> Void
class ScreenshotDetector: NSObject, NSMetadataQueryDelegate {
let query = NSMetadataQuery()
var newFileCallback: NewFileCallback?
@SimonSimCity
SimonSimCity / brew-update-notifier.sh
Last active November 5, 2023 09:30 — forked from stephennancekivell/brew-update-notifier.sh
Extended the script, written by @streeter to exclude the pinned formulae in the list of formulas to update.
#!/bin/bash
#
# Notify of Homebrew updates via Notification Center on Mac OS X
#
# Author: Chris Streeter http://www.chrisstreeter.com
# Requires: terminal-notifier. Install with:
# brew install terminal-notifier
TERM_APP='/Applications/Terminal.app'
BREW_EXEC='/usr/local/bin/brew'
@nderkach
nderkach / ios_github_gif.md
Last active February 15, 2024 23:31
How to record iOS screen and share it on github

Record a screencast with QuickTime Player

  1. Connect an iOS defice with a cable
  2. In QuickTime Player: Option-Cmd-N (New Movie Recording) -> Select your device from the recording menu:

http://cl.ly/image/1w0y3Y0H2g2X/record.png

Install gifify

@cleverdevil
cleverdevil / overcast-recently-played.py
Last active March 4, 2024 09:28
Fetch recently played episodes from Overcast.fm. Then, publish history to my website.
'''
You'll need to pip install some dependencies:
* python-dateutil
* requests
Also, populate your EMAIL and PASSWORD below.
'''
from xml.etree import ElementTree