Skip to content

Instantly share code, notes, and snippets.

@dealforest
dealforest / MnistImageType.swift
Last active Jan 14, 2020
the model automatically generated from mlmodel
View MnistImageType.swift
//
// MnistImageType.swift
//
// This file was automatically generated and should not be edited.
//
import CoreML
/// Model Prediction Input Type
@dealforest
dealforest / slack.py
Last active Jan 24, 2018
send to slack in LLDB
View slack.py
#!/usr/bin/env python
import lldb
def slack(debugger, command, result, internal_dict):
frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
path = command
lldb.debugger.HandleCommand("""
expr -l swift --
View unsigned_xcode_beta.sh
#!/bin/bash -eu
temp_dir=`mktemp --directory`
target_dir=/Applications/Xcode-beta.app/Contents/MacOS
if [ -e $target_dir/Xcode.signed ]; then
echo "already exists Xcode.signed"
exit 1
fi
View gist:edde2632c644c3dc9d04
let request = GitHub.Endpoint.SearchRepositories(query: "APIKit", sort: .Stars)
GitHub.sendRequest(request)
.success { println($0) }
.failure { println($0) }
extension GitHub {
func sendRequest<T: APIKit.Request>(request: T) -> Task<Float, T.Response, NSError> {
return Task { progress, fulfill, reject, configure in
/*
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
@dealforest
dealforest / O0
Last active Aug 29, 2015
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix
View O0
Pass Arguments: -targetlibinfo -datalayout -verify -verify-di
Target Library Information
Data Layout
ModulePass Manager
FunctionPass Manager
Module Verifier
Debug Info Verifier
Bitcode Writer
View gist:c50667424376c09383a9
# http://stackoverflow.com/questions/4023830/bash-how-compare-two-strings-in-version-format/4025065#4025065
# 0: =, 1: >, 2: <
vercomp () {
if [[ $1 == $2 ]]
then
return 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
View gist:c8375759d9451b146723
Incident Identifier: 4443D885-3C0C-4582-86BA-C2FC85F9FAC5
CrashReporter Key: 08e4571debddd2c404663681d874fc364222a762
Hardware Model: iPhone5,2
Process: JPKB [255]
Path: /private/var/mobile/Containers/Bundle/Application/E5B12325-F84A-4BF9-9DF0-24BEE46A7DCB/JapaneseKeyboardKit.app/PlugIns/JPKB.appex/JPKB
Identifier: com.kishikawakatsumi.JapaneseKeyboardKit.JPKB
Version: 1 (1.0)
Code Type: ARM (Native)
Parent Process: launchd [1]
@dealforest
dealforest / post-checkout
Last active Oct 10, 2018
When you switch branch, run the `pod install`. install to `path/to/.git/hooks/`
View post-checkout
#!/bin/sh
set -e
prev="$1"
new="$2"
branch_switch="$3"
if [ -z "$branch_switch" ] || [ $branch_switch -eq 0 ]; then
exit 0 # this was a file checkout
View gist:146fcecdc97da176895e
# GDB
(gdb) info malloc-history <address>
(gdb) shell malloc_history <pid> <address>
# LLDB
(lldb) command script import lldb.macosx.heap
(lldb) malloc_info --stack-history <address>
View .gdbinit
define pv
if $argc == 0
po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]
end
if $argc == 1
po [$arg0 recursiveDescription]
end
end
define st