Skip to content

Instantly share code, notes, and snippets.

View svenmuennich's full-sized avatar

Sven Münnich svenmuennich

View GitHub Profile
@svenmuennich
svenmuennich / compiletexonsave.py
Last active December 16, 2015 13:38
This is a small plugin for Sublime Text 2. It automatically compiles a saved .tex to the same directory. You have to save 'compiletexonsave.py' to '~/Library/Application Support/Sublime Text 2/Packages/CompileTexOnSave/compiletexonsave.py' or similar based on your OS (mine is OSX). To enable auto compiling you have to edit your Sublime project s…
import sublime
import sublime_plugin
import subprocess
import os
from threading import Thread
#####
# The main compile method using the command line to navigate to the saved files directory
# and calling 'pdflatex' on the saved file.
@svenmuennich
svenmuennich / DeviceUID.m
Created October 28, 2015 20:00 — forked from miguelcma/DeviceUID.m
iOS Unique Device ID that persists between app reinstalls
/* DeviceUID.h
#import <Foundation/Foundation.h>
@interface DeviceUID : NSObject
+ (NSString *)uid;
@end
*/
// Device.m
<!-- An ant target for running only tests that are part of the goup 'custom', using also a faster test setup -->
<target name="custom-tests" depends="build-cache-dir, build-config, build-database, build-create-admin-account, build-install-lock-file, build-disable-firstrunwizard">
<exec executable="${script.phpunit}" failonerror="true" dir="${test.dir.shopware}">
<arg value="--log-junit=${log.dir}/junit.xml"/>
<arg value="--group=custom"/>
</exec>
</target>
@svenmuennich
svenmuennich / default.php
Last active October 27, 2017 11:55
Shopware (5.2+) dev config
<?php
return [
'db' => [
'username' => '<USERNAME>',
'password' => '<PASSWORD>',
'dbname' => 'shopware',
'host' => 'localhost',
'port' => '3306'
],
// Disable backend cache
@svenmuennich
svenmuennich / UIViewController+Deselection.swift
Created June 4, 2016 03:10 — forked from ZevEisenberg/LICENSE
Smoothly deselect table and collection view cells on dismissal, including interactive dismiss and interactively-partially-dismiss-then-cancel-then-dismiss-again
extension UIViewController {
func rz_smoothlyDeselectRows(tableView tableView: UITableView?) {
let selectedIndexPaths = tableView?.indexPathsForSelectedRows ?? []
if let coordinator = transitionCoordinator() {
coordinator.animateAlongsideTransitionInView(parentViewController?.view, animation: { context in
selectedIndexPaths.forEach {
tableView?.deselectRowAtIndexPath($0, animated: context.isAnimated())
}
@svenmuennich
svenmuennich / dev_deps
Last active November 3, 2021 21:21
Toggles between composer installed and symlinked shared dependencies of Shopware 5 plugin.
#!/bin/bash
# Check parameters
if [[ $# -ne 2 ]]; then
echo " Usage: $0 <dev|prod> <plugin_path>"
exit 1
fi
mode=$1
plugin_path=$(cd $2 && pwd)
<?php
$referencingTableName = 's_plugin_viison_address_label_dispatch_configuration';
$referencingColumnName = 'dispatchId';
$prefix = 'fk';
$maxSize = 30;
$hash = implode('', array_map(function ($column) {
return dechex(crc32($column));
@svenmuennich
svenmuennich / .profile
Last active November 22, 2018 08:53
A plan for setting up a new Mac for development
# Load NVM
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
# ls coloring etc.
alias ls='ls -Ga'
# Fix Perl locale
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
@svenmuennich
svenmuennich / clear-purgeable-space.sh
Last active June 25, 2021 09:30
Clearing "purgeable" space on macOS High Sierra (e.g. before installing Windows 10 using BootCamp)
# 1. Check for any local time machine snapshots
tmutil listlocalsnapshots /
# 2. Ask time machine to free 100 GBs of local snapshots. Third parameter '4' probably means high priority (https://apple.stackexchange.com/a/398356)
tmutil thinlocalsnapshots / $((100 * 1024 * 1204 * 1024)) 4
# 3. Make sure that only a `(dataless)` snapshot exists
tmutil listlocalsnapshots /
# 4. List all mounted volumes and find the one mounted on '/' (probably '/dev/disk1s1')
@svenmuennich
svenmuennich / gist:b080220b3595ab1e3c2de115a04fd6cb
Created August 14, 2018 20:00
How to create a public and private key pair for RSA encryption
# 1. Generate a new RSA key pair (public and private key) with a 4096 bit long modulus.
# You can optionally pass e.g. '-aes256' to encrypt the key pair with a passphrase. The key
# pair will be saved as 'private.pem' ('pem' is just a container file format,
# see https://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file).
openssl genrsa -out private.pem 4096
# 2. Extract the public key from the RSA key pair ('private.pem').
# The result is again saved in a 'pem' file, this time named 'public.pem'.
openssl rsa -in private.pem -outform PEM -pubout -out public.pem