Skip to content

Instantly share code, notes, and snippets.

View cspinetta's full-sized avatar
👨‍💻
I may be slow to respond.

Cristian Spinetta cspinetta

👨‍💻
I may be slow to respond.
View GitHub Profile
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git
@jaibeee
jaibeee / brew-perms.sh
Last active February 15, 2024 22:49
Configure homebrew permissions to allow multiple users on MAC OSX. Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew

Explaining Miles's Magic

Miles Sabin recently opened a pull request fixing the infamous SI-2712. First off, this is remarkable and, if merged, will make everyone's life enormously easier. This is a bug that a lot of people hit often without even realizing it, and they just assume that either they did something wrong or the compiler is broken in some weird way. It is especially common for users of scalaz or cats.

But that's not what I wanted to write about. What I want to write about is the exact semantics of Miles's fix, because it does impose some very specific assumptions about the way that type constructors work, and understanding those assumptions is the key to getting the most of it his fix.

For starters, here is the sort of thing that SI-2712 affects:

def foo[F[_], A](fa: F[A]): String = fa.toString
@CMCDragonkai
CMCDragonkai / memory_layout.md
Last active July 24, 2024 16:48
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
object Process {
type UserTime = Long
type KernelTime = Long
type StartTime = Long
//Hertz (number of clock ticks per second) of your system.
val Hz: Long = executeCmd("getconf CLK_TCK").map(_.toLong).getOrElse(100L)
/**
@sqs
sqs / sourcegraph-user-config.json
Created January 11, 2018 08:39
Full-text/regexp search across the top 500 Rust crates on Sourcegraph
// Full-text/regexp search across the top 500 Rust crates:
//
// 1. Sign up for Sourcegraph.com at https://sourcegraph.com/sign-up (or sign in)
// 2. Click your username in the top right
// 3. Go to Configuration
// 4. Paste this entire JSON in and click Save
// 5. In the search box, type a search query of the form "repogroup:crates YOUR QUERY"
// and hit enter (regexps, exact matching, etc., are supported)
//
// Examples: "repogroup:crates remove_file"
/*
* =========================================================================================
* Copyright © 2013-2018 the kamon project <http://kamon.io/>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the