Skip to content

Instantly share code, notes, and snippets.

utgarda / 0
Created Feb 22, 2019 — forked from roadrunner2/0
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)
View 0


This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

utgarda / gzip-sample.scala
Created Jan 5, 2016 — forked from sasaki-shigeo/gzip-sample.scala
A sample code of gzip in Scala. API of gzip is included in the package It provides GZIPOutputStream and GZIPInputStream, the subclasses of DeflatterOutputStream and InflatterInputStream, respectively. GZIPOutputStream compresses data into a given output stream and GZIPInputStream decompresses data from an input one.
View gzip-sample.scala
val pi = new PipedInputStream
val po = new PipedOutputStream(pi)
val zo = new GZIPOutputStream(po)
val zi = new GZIPInputStream(pi)
val w = new PrintWriter(zo)
val r = new BufferedReader(new InputStreamReader(zi))
View gifts.cpp
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
struct Tree {
int value;
Tree(int v) : value(v) {}
vector<Tree*> c;
View autocomplete.cpp
#include <iostream>
#include <set>
using namespace std;
int common_prefix(const string& a, const string& b) {
int i = 0;
while (i < a.size() && i < b.size() && a[i] == b[i])
return i;
utgarda / sinkiq.rb
Created Aug 5, 2013
Example of Celluloid::WebSocket::Client usage from inside Sidekiq workers
View sinkiq.rb
# Make sure you have Sinatra installed, then start sidekiq with
# sidekiq -r ./sinkiq.rb
# Simply run Sinatra with
# ruby ./sinkiq.rb
# and then browse to http://localhost:4567
require 'sinatra'
require 'sidekiq'
require 'redis'
require 'celluloid'
View sidekiq_middleware_test.rb
require 'sidekiq'
require 'securerandom'
require 'active_support'
# If your client is single-threaded, we just need a single connection in our Redis connection pool
class GenerateUUID
def call(worker_class, msg, queue)
puts "Here goes middleware, worker_class = #{worker_class}, msg = #{msg}, queue = #{queue}"
if (last_arg = msg['args'].last).is_a? Proc
# Shouldn't they be colored somehow fancy?
colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
#jQuery comes to the resque
containerWidth = $('#container2').width()
containsrHeight = $('#container2').height()
# Add polygons to a layer
addPolygon = (layer) ->
n = layer.getChildren().length + 1
utgarda /
Created Apr 3, 2012
CoffeeScript + jQuery tutorials: Evil Twins hunt
window.publishPost = ->
userId = window.fbUserId
post =
caption: "Evil Twins Hunt"
message: "Found an app to check FB for presence of Evil
Twins from the Evil Parallel Universe. Be watchful, tovarisch!
( And yeah, I also learned how to access FB info and publish
feed items from code, which is cool. )"
link: ""
FB.api "/me/feed", 'post', post
utgarda /
Created Mar 22, 2012 — forked from Chris927/
Reverse a string in CoffeeScript
reverse = (s) ->
if s.length < 2 then s else reverse(s[1..-1]) + s[0]
s = "Hello"
console.log "s=#{s}, s.reverse=#{reverse(s)}"
You can’t perform that action at this time.