Skip to content

Instantly share code, notes, and snippets.

View samnung's full-sized avatar

Roman Kříž samnung

  • Brno, Czech Republic
View GitHub Profile
@samnung
samnung / hapi-sentry.d.ts
Created November 10, 2021 20:17
TypeScript Definition file for hapi-sentry package
declare module 'hapi-sentry' {
import { Plugin } from '@hapi/hapi'
export interface Options {
/**
* uri to be used as base for captured urls
*/
baseUri?: string
scope?: {
@samnung
samnung / pod1.sh
Last active May 1, 2016 13:03
Shortcut to run CocoaPods v1.0 from CococaPods.app when installed older v0.39 in system
function pod1 {
# Find the CocoaPods runner if the cache variable is not set
if [[ -z "$__POD1_LOCATION" || ! -x "$__POD1_LOCATION" ]]; then
local location=`mdfind "kMDItemCFBundleIdentifier = 'org.cocoapods.CocoaPods'"`
export __POD1_LOCATION="${location}/Contents/Helpers/pod"
fi
if [[ -z "$__POD1_LOCATION" || ! -x "$__POD1_LOCATION" ]]; then
echo "Can't find CocoaPods.app" >&2
return 1
@samnung
samnung / do_not_disturb.rb
Last active November 20, 2015 11:41
Script to turn on or off `Do Not Disturb` mode on Mac OS X from console
#!/usr/bin/env ruby
# Get current status of Do Not Disturb mode by reading specific plist file
#
# @return [TrueClass,FalseClass] true if the mode is active
#
def do_not_disturb
plist_file = Dir.glob(Dir.home + '/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist').last
`/usr/libexec/PlistBuddy -c "Print doNotDisturb" "#{plist_file}"`.strip == 'true'
end
@samnung
samnung / zipdiff.sh
Created May 1, 2015 21:16
Simple zipdiff (I have this function in my .zprofile)
function zipdiff {
if [[ $# != 2 ]]; then
echo "$0: simple tool to diff zip files"
echo "usage: $0 <one-zip-file> <other-zip-file>"
return 1
fi
one=`mktemp -t 'zipdiff_1'`
two=`mktemp -t 'zipdiff_2'`
@samnung
samnung / convert_osx_to_iso.sh
Last active August 29, 2015 14:20
Fix detection of application and result existence
#!/usr/bin/env bash
# taken from http://www.fredmastro.com/?p=40
set -e # exit when some command fails
if [[ $# != 2 ]]; then
echo "Usage: $0 <path-to-osx-install-application> <result-ios-path>" >&2