Skip to content

Instantly share code, notes, and snippets.

View gubikmic's full-sized avatar

Michael Gubik gubikmic

View GitHub Profile
@zhangao0086
zhangao0086 / swift_hex.swift
Last active July 28, 2021 22:22
Convert image to hex. NSImage to byte array
// swift
var image = xxx
var rect = NSRect(x: 0, y: 0, width: image.size.width, height: image.size.height)
let cgImage = image.CGImageForProposedRect(&rect, context: nil, hints: nil)!.takeUnretainedValue()
let bitmapRep = NSBitmapImageRep(CGImage: cgImage)
if let imageData = bitmapRep.representationUsingType(NSBitmapImageFileType.NSPNGFileType, properties: [:]) {
let len = imageData.length
var bytes = [UInt8](count: len, repeatedValue: 0)
@ccstone
ccstone / References For Learning & Using Applescript.md
Last active April 14, 2025 10:57
References For Learning & Using Applescript

REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47


NOTES

AppleScript is a rather peculiar scripting language to learn.

@adewes
adewes / README.md
Last active August 12, 2024 20:19
Ebay Ads - Bot. Because who wants to write messages by hand...

To use this bot:

  • Download ads_bot.py and requirements.txt.
  • Type pip install -r requirements.txt to install the requirements.
  • Fill out the required information in the Python file.
  • Ideally, create a (free) Slack account and set up a web hook to receive notifications from the bot.
  • Run the script :)
  • Relax and be ready to answer incoming calls :D
@zenparsing
zenparsing / dedent-template.js
Last active May 5, 2025 14:03
Dedenting Template Strings
function dedent(callSite, ...args) {
function format(str) {
let size = -1;
return str.replace(/\n(\s+)/g, (m, m1) => {
if (size < 0)
size = m1.replace(/\t/g, " ").length;
function isAnimatedGif(src, cb) {
var request = new XMLHttpRequest();
request.open('GET', src, true);
request.responseType = 'arraybuffer';
request.addEventListener('load', function () {
var arr = new Uint8Array(request.response),
i, len, length = arr.length, frames = 0;
// make sure it's a gif (GIF8)
if (arr[0] !== 0x47 || arr[1] !== 0x49 ||
@davidjrice
davidjrice / .travis.yml
Last active October 23, 2019 16:17 — forked from johanneswuerbach/.travis.yml
Travis CI + TestFlight integration (updated for Travis' new Mac VM setup / xctool)
language: objective-c
xcode_workspace: "<WorkspaceName.xcworkspace>"
xcode_scheme: "<SchemaName>"
script: xctool -workspace <WorkspaceName.xcworkspace> -scheme <SchemeName> -configuration Release build archive
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
@eligrey
eligrey / leaks.md
Last active November 22, 2023 23:14
Entities that have sold or leaked my personal data

Eli's leak list

The following entities have either sold or leaked personal data about me, including email addresses and phone numbers. Be wary of sharing your data with them.

Email addresses

These entities have either sold or leaked specific unique email addresses of mine to unauthorized parties, such as spammers.

@admsyn
admsyn / Output
Created August 24, 2012 16:49
Testing vDSP's FFT vs FFTW's
N = 1024 Accel: 0.05265 FFTW: 0.026213
N = 2048 Accel: 0.042565 FFTW: 0.049334
N = 4096 Accel: 0.049206 FFTW: 0.082782
N = 8192 Accel: 0.118918 FFTW: 0.173506
N = 16384 Accel: 0.200201 FFTW: 0.371488
N = 32768 Accel: 0.356826 FFTW: 1.01589
N = 65536 Accel: 0.844955 FFTW: 1.79316
N = 131072 Accel: 1.95759 FFTW: 3.99565
N = 262144 Accel: 4.34179 FFTW: 9.87287
N = 524288 Accel: 9.31858 FFTW: 19.6675
@jacobvosmaer
jacobvosmaer / gist:3187346
Created July 27, 2012 10:35
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs