Skip to content

Instantly share code, notes, and snippets.

Avatar
😴
Completely failing at being productive

Kuba Suder mackuba

😴
Completely failing at being productive
View GitHub Profile
@mackuba
mackuba / download_wwdc.rb
Last active Jun 17, 2021
Script for downloading all WWDC videos from a JSON feed
View download_wwdc.rb
#!/usr/bin/env ruby
# 06/2021: https://devimages-cdn.apple.com/wwdc-services/pb9e2d31/0CF104D6-F0B3-4AE8-B9F0-6F2D9F54A502/contents.json
# 11/2020: https://devimages-cdn.apple.com/wwdc-services/n233a99f/5D23F1E9-9551-4768-ACF3-E3920F9C572D/contents.json
# 5/2019: https://devimages-cdn.apple.com/wwdc-services/j06970e2/296E57DA-8CE8-4526-9A3E-F0D0E8BD6543/contents.json
# 8/2017: https://devimages-cdn.apple.com/wwdc-services/h8a19f8f/049CCC2F-0D8A-4F7D-BAB9-2D8F5BAA7030/contents.json
# 5/2016: http://devimages.apple.com.edgekey.net/wwdc-services/g7tk3guq/xhgbpyutb6wvn2xcrbcz/videos.json
require 'fileutils'
require 'json'
@mackuba
mackuba / fix_deezer.sh
Created Nov 2, 2020
Script to hide cookier banner in Deezer's Electron app
View fix_deezer.sh
#!/bin/bash
set -e
set -x
ARCHIVE="app.asar"
WORKDIR="deezer_unpacked"
TMPFILE="/tmp/deezerupdate.txt"
cd /Applications/Deezer.app/Contents/Resources/
@mackuba
mackuba / note_compiler.rb
Created Jun 6, 2020
Code for formatting hand-written plain text notes into formatted HTML
View note_compiler.rb
class NoteCompiler
def build(text, info)
note = NoteContent.new(text, info)
note.compile_html
end
class NoteContent
def initialize(text, info)
@text = text
@info = info
View wwdc_video_links.json
@mackuba
mackuba / log-exclude-bots.rb
Last active Sep 29, 2020
Scripts for processing Nginx logs for Piwik
View log-exclude-bots.rb
#!/usr/bin/env ruby
require 'optparse'
require 'set'
$buffer = []
$current_day = nil
$validated = Set.new
$invert = false
@mackuba
mackuba / macbook-pro-2016.md
Created Jan 18, 2017
MacBook Pro 2016 - an iOS developer's review
View macbook-pro-2016.md

MacBook Pro 2016 - an iOS developer's review

Here are some thoughts about my new MacBook Pro that I've been using for the last few weeks (the Santa Claus from DHL brought it to me just before Christmas), hopefully this will help someone who's considering getting one.

Note: this is written from the perspective of a person who switched to the MBP from a 2015 13" MacBook Air (i7) and also has a 2012 21" iMac. Your experiences will obviously be different if you have e.g. a fairly recent 15" Retina MacBook Pro.

Specs

  • MacBook Pro 15", late 2016
  • Core i7 2.9 GHz (4 cores)
@mackuba
mackuba / wwdc16.md
Last active Dec 7, 2019
New stuff from WWDC 2016
View wwdc16.md

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).


OSX → macOS 10.12 Sierra

@mackuba
mackuba / content_blocker_tips.md
Last active Apr 13, 2021
Tips for writing iOS content blockers - HelsinkiOS
View content_blocker_tips.md
  • read this first: https://www.webkit.org/blog/3476/content-blockers-first-look/
  • start by adding a new extension target to your iOS app of type “content blocker”
  • launch the app using the main target’s scheme + a call to SFContentBlockerManager.reloadContentBlockerWithIdentifier() with the extension’s id in application:didFinishLaunchingWithOptions: to auto-reload the blocker in development mode
  • if you don’t call reloadContentBlockerWithIdentifier() then you need to switch the blocker off and on again in the Safari settings (stop the app in Xcode if the switch is not moving)
  • use inspector from desktop Safari to inspect the Safari in the simulator in order to find specific things to block
  • things like periods in the url-filter regexp need to be escaped with double backslashes, e.g. facebook\\.net
  • if you use if-domain, it needs to be an array, even for one element
  • domain foo.com might not match www.foo.com even though I think it’s supposed to (UPDATE: They've changed it in one of
@mackuba
mackuba / wwdc15.md
Last active Dec 28, 2020
New stuff from WWDC 2015
View wwdc15.md

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
View wait-google-sent-me.js
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}