Skip to content

Instantly share code, notes, and snippets.

@Daij-Djan
Daij-Djan / CurrenySymbolForIso.mm
Created January 27, 2014 14:31
CurrenySymbolForIso function
NSString *CurrenySymbolForIso(NSString *isoCode) {
NSLocale *locale = [NSLocale currentLocale];
return [locale displayNameForKey:NSLocaleCurrencySymbol value:isoCode];
}
int main(int argc, char *argv[]) {
@autoreleasepool {
NSString *isoCode = @"GBP";
NSString *currency = CurrenySymbolForIso(isoCode);
#!/bin/bash
# This has to be run from develop (NOTE: if master is your main dev branch, edit the file.)
git checkout develop
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
@Daij-Djan
Daij-Djan / UIFont+Traits.h
Last active May 14, 2016 07:00 — forked from anonymous/UIFont+Traits.mm
Easy UIFont Traits Querying (isBold/ isItalic) Found this hidden gem and made it a gist: http://joshua.nozzi.name/2012/08/easy-uifont-bold-and-italic-querying-with/ - and copyng of fonts to add specific traits
#import <UIKit/UIKit.h>
#import <CoreText/CTFont.h>
@interface UIFont (Traits)
@property(nonatomic, readonly) CTFontRef CTFontRef;
@property(nonatomic, readonly) CTFontSymbolicTraits traits;
@property(nonatomic, readonly, getter=isBold) BOOL bold;
@property(nonatomic, readonly, getter=isItalic) BOOL italic;
//MIT
import Foundation
import Contacts
if(NSProcessInfo.processInfo().arguments.count != 2) {
print("Usage: CNPurgeGroup %GROUPNAME%")
}
else {
let groupName = NSProcessInfo.processInfo().arguments[1]
@Daij-Djan
Daij-Djan / ignoreInvalidSSL
Last active May 23, 2016 17:08
show how to properly ignore invalid ssl certificates while leaving other authentication challenges untouuched
//setup a new task
let configuration = NSURLSessionConfiguration.ephemeralSessionConfiguration()
let session = NSURLSession(configuration: configuration, delegate: self, delegateQueue: NSOperationQueue.mainQueue())
let task = session.dataTaskWithURL(url, completionHandler: handleUrlCompleted)
task.resume()
....
//url session needs to accept invalid certificates
func URLSession(session: NSURLSession, didReceiveChallenge challenge: NSURLAuthenticationChallenge, completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void) {
import CocoaLumberjack
import Security
public class EncryptedLogger: DDAbstractLogger {
let key: SecKey!
let blockSize : Int
let padding : SecPadding
init(key: SecKey!, blockSize : Int = 128, padding: SecPadding = .PKCS1) {
self.key = key
package info.pich.camunda.bmp.configuration;
import lombok.Data;
import org.camunda.bpm.engine.AuthorizationService;
import org.camunda.bpm.engine.IdentityService;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.authorization.Groups;
import org.camunda.bpm.engine.authorization.Resource;
import org.camunda.bpm.engine.authorization.Resources;
import org.camunda.bpm.engine.identity.Group;
@Daij-Djan
Daij-Djan / sinatra-command.rb
Created January 19, 2017 15:24
Run a local Webserver with Sinatra that can do actions on your Mac. I mainly want /quiet for my hacked amazon dash button And/Or home control
#!/usr/bin/env ruby
require 'sinatra'
get '/hello' do
value = `osascript -e 'tell app "System Events" to display dialog "Hello"'`
end
get '/lock' do
value = `"/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession" -suspend`
@Daij-Djan
Daij-Djan / ps_osx.sh
Created January 26, 2017 15:18
PS for OSX:: Runs 'ps ax' and verify the code signature of every running proccess using apple's 'codesign' tool
#!/bin/sh
IFS=$'\n'
#help text
usage="$(basename "$0") [-h or -?] [-i] [-a] [-s] [-d] [-u] [-s] [-b]
Runs 'ps ax' and verify the code signature of every running proccess using apple's 'codesign' tool
-h/-? :: help for command
-i :: dont show an inital count before analyzing each process
@Daij-Djan
Daij-Djan / plist-to-json.swift
Created July 20, 2017 13:50
small swift 3 tool to convert an apple plist to json
//
// main.swift
// plist-to-json
//
// Created by Dominik Pich on 20.07.17.
// Copyright © 2017 Dominik Pich. All rights reserved.
//
import Foundation