Skip to content

Instantly share code, notes, and snippets.

@devstopfix
devstopfix / ants.clje
Last active May 14, 2020 15:53
Rich Hickey's ants simulator ported to Clojure on the BEAM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2008 Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;
; Original Clojure JVM code :- https://gist.github.com/michiakig/1093917
@eexit
eexit / Getting a Moto X back to stock on OSX Raw.md
Last active November 28, 2020 17:37
Getting a Moto X back to stock on OSX

Getting a Moto X back to stock on OSX

Backup, first!

  1. Downloads the Android SDK Command Line Tools

     $ unzip android-sdk-macosx.zip
     $ cd android-sdk-macosx
    
  2. Create a backup folder

@crazed
crazed / gist:7670423
Last active September 7, 2023 22:20
getting a moto x back to stock on mac os x
  1. grab the moto-fastboot version of fastboot here

  2. grab the appropriate stock firmware here (tip: you want the one that matches your android build number in settings -> about phone)

  3. unzip this file somewhere and make it easy to run the moto-fastboot-osx64 command from step 1

  4. get your phone into fastboot mode, google it if needed but just power the phone off, hold the down volume key and power button for 3 seconds then let go, should get you there

  5. verify you are ready for flashing:

     ./moto-fastboot-osx64 devices
     -- should list a device --
    
  6. most of the time you just need to flash system and recovery images, so from your unzipped stock firmware files do this:

@gburd
gburd / bitpop.erl
Last active July 2, 2018 06:27
Hamming weight of 64bit integers in Erlang using the popcount_3() method found http://en.wikipedia.org/wiki/Hamming_weight counts the number of bits set to 1.
%% -*- coding: utf-8 -*-
%%
%% %CopyrightBegin%
%%
%% Copyright (C) 2013 Gregory Burd. All Rights Reserved.
%%
%% The contents of this file are subject to the Mozilla Public License,
%% Version 2, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Mozilla Public License along with this software. If not, it can be
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@btoone
btoone / curl.md
Last active April 2, 2024 20:18
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
InfoQ have recently published a video of a very interesting interview with Rich Hickey, creator of the Clojure programming language. Conveniently, they also offer a transcript of the entire interview, but as is costumary with their transcripts, it is placed inside a very small text field, making for very awkward reading. Here's a copy of that transcript, extracted from http://www.infoq.com/interviews/hickey-clojure
Q: We are here at QCon London 2009, with Rich Hickey. Rich, who are you?
A: I'm the author of Clojure. I'm an independent developer, contractor, consultant and,
basically, a practitioner. I'm not a researcher.
Q: What brought you to create a Lisp? Do you go out in the morning and say "Hey, I'm bored!
Let's create the Lisp!"? What's the intention behind it?
@ngerakines
ngerakines / memoize.erl
Created September 27, 2008 17:55
A small module to provide memoize functions in Erlang.
%% Copyright (c) 2008 Nick Gerakines <nick@gerakines.net>
%%
%% Permission is hereby granted, free of charge, to any person
%% obtaining a copy of this software and associated documentation
%% files (the "Software"), to deal in the Software without
%% restriction, including without limitation the rights to use,
%% copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the
%% Software is furnished to do so, subject to the following
%% conditions: