Skip to content

Instantly share code, notes, and snippets.

Converting ideas into fun

Serg ReDetection

Converting ideas into fun
View GitHub Profile

Useful resources that were used to build the memory graph application. This is also a set of interesting materials which are related to memory understanding.

Source code

  1. The Memory Graph Project builds the memory graph of the application
  2. Python implementation of searching object's references and other interesting features via (lldb) script import lldb.macosx.heap
  3. C++ implementation of searching object's references
  4. FLEX set of in-app debugging and exploration tools for iOS development

Materials and media

  1. WWDC 2018 session iOS Memory Deep Dive
fichek / iPhone X Simulator
Last active Mar 3, 2021
iPhone X Simulator Screenshots
View iPhone X Simulator

Now that you can finally™ submit iPhone X screenshots of your apps to iTunes Connect, here's an easy Terminal command to take a proper screenshot:

xcrun simctl io booted screenshot "~/Desktop/Simulator Screen Shot - iPhone X - $(date +'%Y-%m-%d at %H.%M.%S').png"

This will use Xcode's built-in Simulator command line utility to save a full-frame screenshot of the iPhone X simulator (assuming it's the only one running), without cutting of the notch and rounded corners like cmd+s does. Name is formatted the same as cmd+s would do it and it's also saved to desktop.

Important thing to note: if Debug -> Optimize Rendering for Window Scale is on, screenshot might be saved at wrong resolution, so either turn that off or make sure it's at 100% scale before taking the screenshot (not "Actual Size", but 100%).

View homebridge
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
CraigSiemens / iflet.m
Last active May 2, 2021 — forked from jspahrsummers/iflet.m
if-let and guard macros for Objective C
View iflet.m
#import <Foundation/Foundation.h>
// VARIABLE must be a variable declaration (NSString *foo)
// VALUE is what you are checking is not nil
// WHERE is an additional BOOL condition
#define iflet(VARIABLE, VALUE) \
ifletwhere(VARIABLE, VALUE, YES)
#define ifletwhere(VARIABLE, VALUE, WHERE) \
iamcam /
Last active Aug 29, 2015
Automate iOS + WatchKit extension build numbers w/ Git
if [ ${CONFIGURATION} == "AppStore" ]; then
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName/AppName-Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName WatchKit App/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName WatchKit Extension/Info.plist"
if [ ${CONFIGURATION} == "Release" ]; then
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName/AppName-Info.plist"
jonelf / standard_deviation.swift
Last active May 7, 2021
Standard Deviation in Swift
View standard_deviation.swift
func standardDeviation(arr : [Double]) -> Double
let length = Double(arr.count)
let avg = arr.reduce(0, {$0 + $1}) / length
let sumOfSquaredAvgDiff = { pow($0 - avg, 2.0)}.reduce(0, {$0 + $1})
return sqrt(sumOfSquaredAvgDiff / length)
let responseTimes = [ 18.0, 21.0, 41.0, 42.0, 48.0, 50.0, 55.0, 90.0 ]
74monkeys / AdHocManifestTemplate.plist
Created Sep 25, 2014
Manifest Template for OTA iOS Ad Hoc Distribution
View AdHocManifestTemplate.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
dergachev /
Last active Sep 9, 2021
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

AppLamp-API / commands.js
Last active Mar 1, 2018
API Byte commands for / Mi Light RGB / RGBW / Dual White Wifi LED bulbs and controllers
View commands.js
Filename: commands.js led light API: wifi box byte commands
© you can share,modify and use this code (commercially) as long as you
keep the referer " led light API" in the file header.
The functions in this file will return the appropriate hex commands as 3 byte array
to send to an UDP-socket towards WIFI BOX-IP:8899 (see wifibox.js)