Skip to content

Instantly share code, notes, and snippets.

View username0x0a's full-sized avatar
🐡
πŸ™‰ πŸ™ˆ πŸ™Š

Michal Zelinka username0x0a

🐡
πŸ™‰ πŸ™ˆ πŸ™Š
View GitHub Profile
@steipete
steipete / SpinlockTestTests.swift
Last active January 20, 2025 15:55 — forked from RomanTruba/Synchronization_test_iOS_SDK10
Updated for Xcode 8, Swift 3; added os_unfair_lock
//
// SpinlockTestTests.swift
// SpinlockTestTests
//
// Created by Peter Steinberger on 04/10/2016.
// Copyright Β© 2016 PSPDFKit GmbH. All rights reserved.
//
import XCTest
@scottstanfield
scottstanfield / osx-defaults.sh
Created July 18, 2016 03:40
Lots of OSX defaults
#!/bin/sh
# 90% from http://mths.be/osx
# ask for admin password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@DaveWoodCom
DaveWoodCom / fixXcode6OnElCapitan.sh
Last active September 8, 2023 21:02
Script to fix Xcode 6.x so that it will run on El Capitan
#!/bin/bash
## Copyright (C) 2015 Cerebral Gardens http://www.cerebralgardens.com/
##
## Permission is hereby granted, free of charge, to any person obtaining a copy of this
## software and associated documentation files (the "Software"), to deal in the Software
## without restriction, including without limitation the rights to use, copy, modify,
## merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
## permit persons to whom the Software is furnished to do so, subject to the following
## conditions:
@TheFox
TheFox / lldb_01.txt
Last active August 22, 2024 03:33
Cracking Hopper App
:> lldb Hopper.app
lldb:> target create "Hopper.app"
error: unable to find CIE at 0xf1bf1410 for cie_id = 0x0e410000 for entry at 0x00001404.
error: unable to find CIE at 0xfb722890 for cie_id = 0x048e0583 for entry at 0x00002e0f.
Current executable set to 'Hopper.app' (x86_64).
lldb:> run
Process 86127 launched: 'Hopper.app' (x86_64)
Process 86127 exited with status = 45 (0x0000002d)
@wesleyit
wesleyit / crontab_header.sh
Created September 26, 2014 20:03
A default crontab header that will make the life easier for those who don't remember cron fields or keywords.
## CRONTAB HINTS AND TIPS
##
##
## Entry Description Equivalent To
## @yearly (or @annually) Run once a year at midnight in the morning of January 1 0 0 1 1 *
## @monthly Run once a month at midnight in the morning of the first of the month 0 0 1 * *
## @weekly Run once a week at midnight in the morning of Sunday 0 0 * * 0
## @daily Run once a day at midnight 0 0 * * *
## @hourly Run once an hour at the beginning of the hour 0 * * * *
## @reboot Run at startup @reboot
@vyspiansky
vyspiansky / oddities.js
Last active December 4, 2019 08:12
JavaScript: oddities
/*
* Source: http://goo.gl/uCbje5
* Author: Eugene Zlobin
* Author Google+ Profile: http://goo.gl/REGj9K
*/
'5' + 4 // 54
5 + '4' // 54
5 + + '4' // 9
'5' * '2' // 10
//I also found that you can do:
//To register for change events:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleWhateverChange) name:@"whateverChange" object:nil];
//To fire them. I might be a N00b but I just couldn't get the observer for key path thing to work for me.
[[NSNotificationCenter defaultCenter] postNotificationName:@"whateverChange" object:nil];
@aras-p
aras-p / preprocessor_fun.h
Last active May 3, 2025 13:47
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@seanbuscay
seanbuscay / git_create_orphan.sh
Created June 27, 2013 15:26
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active May 27, 2024 12:11
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>