Skip to content

Instantly share code, notes, and snippets.

View boyvanamstel's full-sized avatar
👋
Hi there

Boy van Amstel boyvanamstel

👋
Hi there
View GitHub Profile
@boyvanamstel
boyvanamstel / gist:2919778
Created June 12, 2012 19:58
Enable/Disable 'Gatekeeper' in Mac OS X Lion for testing purposes
$ sudo spctl --master-enable
$ sudo spctl --master-disable
# Read more: http://forums.appleinsider.com/t/143736/gatekeeper-is-hidden-in-os-x-10-7-3-lion-developers-can-preview-it-now
@boyvanamstel
boyvanamstel / archive-post-action.sh
Last active July 17, 2023 04:53
Xcode archive post-action to copy zip, dSYM and DMG (using DropDMG) to desktop
VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${SOURCE_ROOT}/${INFOPLIST_FILE}")
BUILD=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${SOURCE_ROOT}/${INFOPLIST_FILE}")
# The build number gets automatically increased by a build phase
BUILD=$((BUILD - 1))
DATE=$(/bin/date +%Y%m%d%H%M%S)
OUTPUT_DIR="${HOME}/Desktop/${TARGET_NAME}_v${VERSION}b${BUILD}_${DATE}"
mkdir "$OUTPUT_DIR"
# Zip and copy .dSYM
cd "${ARCHIVE_DSYMS_PATH}/"
/usr/bin/zip -r "$OUTPUT_DIR/${TARGET_NAME}.dSYM.zip" "${TARGET_NAME}.app.dSYM"
@boyvanamstel
boyvanamstel / youtube.lua
Created September 15, 2012 21:46
Fixed VLC youtube.lua parser
-- Apparently YouTube changed some stuff. This makes VLC play YouTube clips again.
-- Replace youtube.lua in /Applications/VLC.app/Contents/MacOS/share/playlist/youtube.lua.
-- Ticket @ VLC: https://trac.videolan.org/vlc/ticket/7471
--[[
$Id$
Copyright © 2007-2011 the VideoLAN team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
extension NSDirectionalEdgeInsets {
/// Returns new insets with just a value applied to the supplied edge.
///
/// - Parameters:
/// - edge: The edge to apply an inset to.
/// - value: The value to set the edge inset to.
init(_ edge: WritableKeyPath<Self, CGFloat>, _ value: CGFloat) {
self.init(
top: edge == \.top ? value : 0.0,
@boyvanamstel
boyvanamstel / PreferencesManager.c
Created November 30, 2011 14:46
Objective-C class to loop through startup items with Automatic Reference Counting (ARC) enabled
// Based on http://www.bdunagan.com/2010/09/25/cocoa-tip-enabling-launch-on-startup/
// Almost automatic convert to ARC, might need tweaking.
#import "PreferencesManager.h"
@implementation PreferencesManager
// MIT license
- (BOOL)isLaunchAtStartup {
// See if the app is currently in LoginItems.
@boyvanamstel
boyvanamstel / gist:1146834
Created August 15, 2011 14:12
Show all output of exec() or system() commands in PHP or Rails
Just append 2>&1 to the command to redirect all ouput to standard out instead of the error stream.
Source: http://stackoverflow.com/questions/714740/php-exec-is-failing-silently
@boyvanamstel
boyvanamstel / gist:1055880
Created June 30, 2011 08:52
Show custom post types on tag, category and archive pages in Wordpress
<?php
/**
* Also show custom post types in tag/category/archive pages
*/
function query_post_type($query) {
if(is_category() || is_tag()) {
$post_type = get_query_var('post_type');
if($post_type) {
$post_type = $post_type;
} else {
@boyvanamstel
boyvanamstel / organize_games
Last active November 23, 2018 11:21
Game organizer bash script.
#!/bin/sh
#
# Organizes a directory of games into a more convenient layout:
#
# Games/
# - 0-9/
# - A/
# - B-D/
# - E-H/
# - I/
@boyvanamstel
boyvanamstel / gist:989628
Created May 24, 2011 20:47
Resize image in Android
// Source: http://www.anddev.org/resize_and_rotate_image_-_example-t621.html
// load the origial BitMap (500 x 500 px)
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
R.drawable.android);
int width = bitmapOrg.width();
int height = bitmapOrg.height();
int newWidth = 720;
@boyvanamstel
boyvanamstel / get-manual.sh
Created March 7, 2017 22:35
MarkeyJester’s Motorola 68000 Beginner’s Tutorial Readability Update
#!/bin/sh
#
# Download a copy of the manual, you'll need wget (brew install wget)
#
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --random-wait --domains mrjester.hapisan.com --no-parent http://mrjester.hapisan.com/04_MC68/Index.html
cd mrjester.hapisan.com/04_MC68
#