Skip to content

Instantly share code, notes, and snippets.

View joedevivo's full-sized avatar
💻
commands

Joe DeVivo joedevivo

💻
commands
View GitHub Profile
@puffnfresh
puffnfresh / SpacesDemo.m
Created November 11, 2012 07:19
Demo of Spaces API discovered via reverse engineering
#include <Carbon/Carbon.h>
typedef uint64_t CGSConnection;
extern CGSConnection _CGSDefaultConnection(void);
#define CGSDefaultConnection _CGSDefaultConnection()
typedef uint64_t CGSSpace;
typedef enum _CGSSpaceType {
kCGSSpaceUser,
kCGSSpaceFullscreen,
@vinoski
vinoski / fd_setsize_on_osx.md
Last active November 7, 2017 06:20
How to raise the maximum number of file descriptors when building Erlang/OTP on OS X.

When you build Erlang/OTP on OS X, it unfortunately defaults to handling a maximum of 1024 file descriptors. You can get around this limitation with the right combination of configuration options and manual changes to a generated config file.

First, go into your unpacked Erlang/OTP source directory and run the following command, replacing the value 10000 with whatever value you want for max file descriptors:

perl -i -pe 's/(define\s+FD_SETSIZE\s+)\d+/\1 10000/' erts/config.h.in 

Next, when you run configure in your Erlang/OTP source directory, be sure to include the right CFLAGS setting, as shown below:

CFLAGS='-DREDEFINE_FD_SETSIZE -DFD_SETSIZE=15000 -D_DARWIN_UNLIMITED_SELECT' ./configure --enable-kernel-poll <other options>
@jaredmorrow
jaredmorrow / smartos-versions.md
Last active December 14, 2015 00:38
Which SmartOS package to use

SmartOS albeit powerful, makes some easy things like figuring out a "version" of SmartOS very difficult and confusing. To someone like Basho who makes packages for SmartOS, it is enough to drive us (me) insane trying to figure out how to label the packages.

The problem lies in trying to define the version at all. Is the version you care about listed in uname -a? How about a file in /etc/ that tells you? The answer to bolth of those questions is "no". uname -v gives you a string like joyent_20130125T031721Z The only file in /etc/ that comes close is pkgsrc_version, but that is only sometimes available on the system. The real answer is a combination of the Global Zone snapshot version and the pkgsrc version in the guest zones.


So how do I label my packages for SmartOS?

With the uname -v example above, joyent_20130125T031721Z describes the global zone, and has some influence on how apps run, but not enough to determine which package will work on which system. Plus I d

#!/usr/bin/env emacs --script
;; should likely be called with 2</dev/null to suppress the various
;; output to the shell.
;; I think that this is going to fail non-emacs24 installs, since
;; 'package isn't installed by default there. You'll see this error:
;; "Symbol's function definition is void: package-initialize"
;; `brew install emacs` should fix you up, though.
(package-initialize)
@ejpcmac
ejpcmac / shell.nix
Last active February 12, 2024 18:03
Example shell.nix for Elixir projects using a preversion
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
elixir_1_7_0_rc_1 = { mkDerivation }:
mkDerivation rec {
version = "1.7.0-rc.1";
# Use `nix-prefetch-github --rev <version> elixir-lang elixir` to update.
sha256 = "1hp1zdscq7h2qcgcfbzw5dx1wxy05bqlrxvv5kcl8414c69inx8g";
@mbbx6spp
mbbx6spp / .00readme.org
Last active August 22, 2023 02:42
A caching and persistent Nix shell with direnv

Cached and Persistent Nix shell with direnv integration

Problem being solved

  • the default direnv Nix integration from projects loads a Nix shell every new terminal or every time shell.nix and/or default.nix changes. On larger projects with a lot of Nix shell dependencies, that can cause the terminal to take more than 6 seconds to load, which significantly degrades the developer experience (DX).
  • when a developer garbage collects in their Nix store, often the Nix shell dependencies are deleted also which causes a slow start the next time the project’s Nix shell is requested, also degrading developer experience (DX).

Solution outline

  • on first Nix shell load, the Nix shell is evaluated fully such that direnv dumps the environment from the spawn Nix shell process
@charlesjohnson
charlesjohnson / Brewfile
Last active March 18, 2020 19:16
Brewfile
# Taps
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
tap "sambadevi/powerlevel9k"
# Brew CLI apps
brew "fd"
brew "fzf"
@yzl
yzl / TechAndEthicsReadingCollection.md
Last active October 5, 2020 22:13
tech and ethics reading collection

Tech and ethics reading collection

A list of books, essays, papers, blog posts, tweets, etc. on tech and ethics that I have either read and found useful or plan to read because I think they might be useful. I’m not especially interested in ethics that doesn’t take power or structure into account, so most of the standard texts one would read in a course on ethics aren’t represented on my list.

(My) starting point

Not strictly about either ethics or tech, but Claire Dederer’s What Do We Do With the Art of Monstrous Men? verbalizes something that is wound up in how I think about ethics, and what I hear when people talk about ethics:

This, I think, is what happens to so many of us when we consider the work of the monster geniuses—we tell ourselves we’re having ethical thoughts when really what we’re having is moral feelings.

Ideal theory

Dr. Robin James recommends Charles Mills’ [Ideal Theory as I

@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@sperand-io
sperand-io / worker.js
Last active October 28, 2023 09:41
Cloudflare Workers / Segment Smart Proxy — serve data collection assets and endpoints from your own domain
/**
* Steps to use:
* 1. Create CF Worker, copy and paste this in
* 2. (Optional) Update configuration defaults
* - If you want to manage in code, do so below under "Static Configuration"
* - If you want dynamic custom config: Create CFW KV namespace, link them, and add reference below
*
* - You can overwrite default path prefix for loading analytics.js (<yourdomain>/ajs)
* (corresponding KV entry: `script_path_prefix`)
* - You can overwrite default path prefix for handling first-party data collection (<yourdomain>/data)