Skip to content

Instantly share code, notes, and snippets.

View jayniz's full-sized avatar
💭
I like turtles!

Jannis Hermanns jayniz

💭
I like turtles!
View GitHub Profile
@brandt
brandt / README.md
Last active February 3, 2024 01:28
Creates a loopback alias with IP 127.0.0.2 at startup on Mac OS X

Loopback Alias

Creates an alias on the loopback interface (lo0) with the IP 127.0.0.2 on macOS.

Installation

  1. Install the plist to: /Library/LaunchDaemons/com.runlevel1.lo0.127.0.0.2.plist
  2. Set mode: sudo chmod 0644 /Library/LaunchDaemons/com.runlevel1.lo0.127.0.0.2.plist
  3. Set owner: sudo chown root:wheel /Library/LaunchDaemons/com.runlevel1.lo0.127.0.0.2.plist
  4. Load: sudo launchctl load /Library/LaunchDaemons/com.runlevel1.lo0.127.0.0.2.plist
@keo
keo / bootstrap.sh
Last active January 25, 2024 15:49
Setup encrypted partition for Docker containers
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
@deanishe
deanishe / workflow-build.py
Last active July 7, 2023 14:46
Build Alfred Workflows into .alfredworkflow (zip) files
#!/usr/bin/python
# encoding: utf-8
#
# Copyright (c) 2013 deanishe@deanishe.net.
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2013-11-01
#
@igrigorik
igrigorik / ruby-1.9-tips.rb
Created February 3, 2011 17:19
Ruby 1.9 features, tips & tricks you may not know about...
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@reyjrar
reyjrar / logstash-template.json
Last active July 4, 2018 14:39
Template for logstash indexes
{
"template": "logstash-*",
"settings" : {
"index.number_of_shards" : 3,
"index.number_of_replicas" : 1,
"index.query.default_field" : "@message",
"index.routing.allocation.total_shards_per_node" : 2,
"index.auto_expand_replicas": false
},
"mappings": {
@hansemannn
hansemannn / titanium-auth-session.js
Last active February 13, 2018 20:07
Use Axway Hyperloop to perform OAuth-sessions with the iOS 11+ API "SFAuthenticationSession"
const SFAuthenticationSession = require('SafariServices/SFAuthenticationSession');
const NSURL = require('Foundation/NSURL');
const session = SFAuthenticationSession.alloc().initWithURLCallbackURLSchemeCompletionHandler(
NSURL.alloc().initWithString('https://github.com/login/oauth/authorize?scope=repo&client_id=XXXXX'),
'appcgithub://',
function(url, error) {
if (error != null) {
Ti.API.error('Error performing OAuth: ' + error.localizedDescription);
cb({ success: false, error: 'Error performing OAuth: ' + error.localizedDescription });
@gcoop
gcoop / cachedImageView.js
Created May 18, 2011 13:26
Appcelerator Titanium ImageView /w cache and cacheage. Supports retina display.
cachedImageView = function(basedir, uri, obj, attr, cacheage) {
/**
Appcelerator Titanium ImageView /w cache
This function attempts to cache a remote image and then returns it again
when it's requested.
The file is stored in a directory "basedir," this is to try and help
you keep files unique. It's not special or magical, but not dirty either.