Skip to content

Instantly share code, notes, and snippets.

@utgarda
utgarda / 0 Linux-On-MBP-Late-2016.md
Created February 22, 2019 10:32 — forked from roadrunner2/0 Linux-On-MBP-Late-2016.md
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

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 https://github.com/Dunedan/mbp-2016-linux . 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
utgarda / gzip-sample.scala
Created January 5, 2016 18:31 — forked from sasaki-shigeo/gzip-sample.scala
A sample code of gzip in Scala. API of gzip is included in the package java.util.zip. 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.
import java.io._
import java.util.zip._
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))
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
struct Tree {
int value;
Tree(int v) : value(v) {}
vector<Tree*> c;
};
#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])
++i;
return i;
@utgarda
utgarda / reverse.coffee
Created March 22, 2012 12:25 — forked from Chris927/reverse.coffee
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)}"
@utgarda
utgarda / LinkedInClient.coffee
Created March 3, 2012 16:42 — forked from brikis98/LinkedInClient.coffee
LinkedIn API Client in CoffeeScript
OAuth = require('oauth').OAuth
_ = require 'underscore'
class LinkedInClient
@baseUrl: 'https://api.linkedin.com'
@requestTokenUrl: "#{@baseUrl}/uas/oauth/requestToken"
@accessTokenUrl: "#{@baseUrl}/uas/oauth/accessToken"
@authorizeUrl: "#{@baseUrl}/uas/oauth/authorize"
@profileFields: ['id', 'headline', 'first-name', 'last-name', 'public-profile-url', 'picture-url', 'educations', 'positions', 'email-address']
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {
%%% File : ahocorasik.erl
%%% Author : Fyodor Ustinov <ufm@ufm.su>
%%% Descrip.: Multiple search based on Aho-Corasick string matching algorithm
%%%
%%% License : GPL
%%%
%%% Usage:
%%% ahocorasik:match(["pat1", "pat2"], "pat1 pat2 pat1")
%%% or
%%% Tree = ahocorasick:tree(["pat1", "pat2"])