Skip to content

Instantly share code, notes, and snippets.

View gregoryvit's full-sized avatar

Gregory Berngardt gregoryvit

View GitHub Profile
# <TULSI> LLDB bridge [:
# This was autogenerated by Tulsi in order to modify LLDB source-maps at build time.
command source /Users/gregoryvit/.lldbinit-tulsiproj
# ]: <TULSI> LLDB bridge
command script import /usr/local/opt/chisel/libexec/fbchisellldb.py
command script import ~/Development/lldb/keychain.py
command script import ~/Development/lldb/getjson.py
@gregoryvit
gregoryvit / Makefile
Created July 20, 2020 21:34
Makefile to simplify launchd scripts generation
SCRIPTID=my.awesome.script.identifier
ERRORLOGPATH=${HOME}/launchd.${SCRIPTID}.stderr.log
HOURS=9
MINUTES=0
SCRIPT_TO_RUN_PATH=`pwd`/run.sh
install:
cp ./launchd.plist ~/Library/LaunchAgents/${SCRIPTID}.plist
launchctl load ~/Library/LaunchAgents/${SCRIPTID}.plist
@gregoryvit
gregoryvit / SwiftItemsExtractor.py
Created June 25, 2020 14:53
SourceKitten Swift items extractor
import subprocess
import json
class SwiftItemsExtractor:
SOURCEKIT_SUBSCTRUCTURE_KEY = "key.substructure"
SOURCEKIT_OFFSET_KEY = "key.offset"
SOURCEKIT_LENGTH_KEY = "key.length"
SOURCEKIT_COMMENT_KEY = "key.doc.comment"
SOURCEKIT_NAME_KEY = "key.name"
@gregoryvit
gregoryvit / pbpaste_example.py
Last active April 26, 2020 12:07
Simple and quite handy snippets for macOS pasteboard manipulations from python
import subprocess
import os
def cb_paste(use_bytes=False):
"""
Returns the data from macOS pastboard
"""
p = subprocess.Popen(['pbpaste'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
@gregoryvit
gregoryvit / example.py
Created February 5, 2018 09:42
Simple decorator for results caching
from simple_cacher import cacheable_result
@cacheable_result('temp.p', needs_to_cache=False)
def get_data():
# Some data fetching operation
return [1, 2, 3, 4]
@gregoryvit
gregoryvit / print_unicode_symbol.sh
Last active January 10, 2018 15:07
Print unicode code of symbol from clipboard (macOS)
#!/bin/bash
echo -n "$(pbpaste)" | iconv -f utf-8 -t utf-32be | xxd -p | sed 's/^0/0x/' | xargs printf 'U+%04X\n'
@gregoryvit
gregoryvit / PPZeplinTextsPlayground.swift
Created September 6, 2017 08:42
Pixel perfect Zeplin texts
let view = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 480.0, height: 480.0))
view.backgroundColor = UIColor.white
// Body text
let bodyStyle = TextStyle(
fontSize: 16.0,
weight: UIFontWeightRegular,
lineHeight: 24.0,
@gregoryvit
gregoryvit / WebViewBasedPlayground.swift
Last active September 28, 2023 18:03
WebView based Swift playground
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
class ViewController:UIViewController{
lazy var webView: UIWebView = UIWebView(frame: self.view.bounds)
override func viewDidLoad() {