Skip to content

Instantly share code, notes, and snippets.

View karstengresch's full-sized avatar
:octocat:
.

Karsten Gresch karstengresch

:octocat:
.
View GitHub Profile
67 facebook-ios-sdk
48 Bolts-iOS
39 AFNetworking
38 Google-Mobile-Ads-SDK
38 Reachability (Apple)
37 Crashlytics
31 Flurry-iOS-SDK
30 CocoaPods
29 GoogleConversionTracking
26 SDWebImage
@karstengresch
karstengresch / grab_email.sh
Created December 9, 2015 17:11
Extract e-mail information from a website w/ curl (username/password)
curl -u <user>:<pwd> --anyauth http://<url> | grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b" | awk '!x[$0]++' > `echo $(date +'%Y')`_emails.txt
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@karstengresch
karstengresch / git2go-merge-local-branch.go
Created January 12, 2017 17:39 — forked from danielfbm/git2go-merge-local-branch.go
how to merge two local branches using git2go
package main
import (
"errors"
"log"
"github.com/libgit2/git2go"
)
func mergeBranches(repo *git.Repository, sourceBranchName string, destinationBranchName string) error {
// Assuming that these two branches are local already
sourceBranch, err := repo.LookupBranch(sourceBranchName, git.BranchLocal)
@karstengresch
karstengresch / open iTerm
Created January 17, 2017 19:30
Peter Down's (et al.) Finder-iTerm solution, see http://peterdowns.com/posts/open-iterm-finder-service.html
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (folder of the front window as alias))
end tell
CD_to(dir_path)
end run
on CD_to(theDir)
tell application "iTerm"
activate
@karstengresch
karstengresch / Open in iTerm2
Last active January 17, 2017 19:50
Apple script to open an iterm2 "nightly" window from right-clicking on a file or folder in Finder. To use:(1) Open Automator(2) Create a new service(3) Change "Service receives selected" drop downs to "Files or folders" in "Finder"(4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
-- https://gist.github.com/shuntaroy/e5ce3ad61c0deb7e27f0
--
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
set dir_path to quoted form of (POSIX path of my_file)
@karstengresch
karstengresch / Gogs-Docker.adoc
Created March 28, 2017 09:30 — forked from mgreau/Gogs-Docker.adoc
Gogs Docker Env (docker-compose)

Replace 192.168.99.100 by your DOCKER_HOST IP

# Configure the server
curl 'http://192.168.99.100:3000/install' \
  -H 'Origin: null' -H 'Accept-Encoding: gzip, deflate' \
  -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' \
  -H 'Upgrade-Insecure-Requests: 1' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36' \
@karstengresch
karstengresch / authserver.go
Created July 5, 2017 14:17 — forked from elithrar/authserver.go
HTTP Basic Auth example in Go (based on http://stackoverflow.com/a/21937924/556573 + bespoke middleware implementation)
package main
import (
"encoding/base64"
"github.com/gorilla/mux"
"net/http"
"strings"
)
func main() {
@karstengresch
karstengresch / authserver.go
Created July 5, 2017 14:17 — forked from elithrar/authserver.go
HTTP Basic Auth example in Go (based on http://stackoverflow.com/a/21937924/556573 + bespoke middleware implementation)
package main
import (
"encoding/base64"
"github.com/gorilla/mux"
"net/http"
"strings"
)
func main() {
@karstengresch
karstengresch / red_hat_3scale.sh
Last active July 7, 2017 14:22
3scale setup on openshift
# as per the documentation at https://support.3scale.net/guides/infrastructure/onpremises20-installation
THREESCALE_PROJECTNAME="3scale-amp"
THREESCALE_AMP_TEMPLATE="https://raw.githubusercontent.com/3scale/3scale-amp-openshift-templates/2.0.0.GA-redhat-2/amp/amp.yml"
WILDCARD_DOMAIN="192.168.42.249.nip.io"
oc login -u system:admin
oc new-project $THREESCALE_PROJECTNAME
oc new-app --file $THREESCALE_AMP_TEMPLATE --param WILDCARD_DOMAIN=$WILDCARD_DOMAIN