screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
screen -AmdS docker ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
screen -r docker
# enter, then disconnect with Ctrl-a d
screen -S docker -p 0 -X stuff $(printf root\\r\\n)
screen -r docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RetryableTyphoeus | |
require 'typhoeus' | |
include Typhoeus | |
DEFAULT_RETRIES = 1 | |
class Request < Typhoeus::Request | |
def original_on_complete=(proc) | |
@original_on_complete = proc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.stefanwrobel.com/how-to-make-vagrant-performance-not-suck | |
config.vm.provider "virtualbox" do |v| | |
host = RbConfig::CONFIG['host_os'] | |
# Give VM 1/4 system memory & access to all cpu cores on the host | |
if host =~ /darwin/ | |
cpus = `sysctl -n hw.ncpu`.to_i | |
# sysctl returns Bytes and we need to convert to MB | |
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var child_process = require('child_process'); | |
exports.handler = function(event, context) { | |
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' }); | |
proc.on('close', function(code){ | |
if(code !== 0) { | |
return context.done(new Error("Process exited with non-zero status code")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to build: "CC=clang go build" | |
package main | |
import ( | |
"fmt" | |
"net/url" | |
"strconv" | |
"unsafe" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://mirror.sdunix.com/gnu/emacs/emacs-24.5.tar.gz | |
tar zxvfp emacs-24.5.tar.gz | |
cd emacs-24.5/ | |
./configure | |
sudo yum -y install libXpm-devel libjpeg-turbo-devel openjpeg-devel openjpeg2-devel turbojpeg-devel giflib-devel libtiff-devel gnutls-devel libxml2-devel GConf2-devel dbus-devel wxGTK-devel gtk3-devel | |
./configure | |
make | |
sudo make install |
Hacking CORS restriction to enable in-browser XHR to any server.
Say you are running an web app at localhost, and you want to send XHR to http://remote-server:80
, but the CORS restriction forbids access because you are sending requests from an origin that remote-server:80 does not allow.
Run:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ...}: | |
with lib; | |
let | |
cfg = config.services.crd; | |
in { | |
options = { | |
services.crd = { | |
enable = mkEnableOption '' | |
chrome remote desktop, a service which allows for remote control of your desktop from anywhere. | |
''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
#{stdenv, fetchFromGitHub, python, ninja}: | |
stdenv.mkDerivation rec { | |
name = "scylla-${version}"; | |
version = "2.1.0"; | |
src = fetchgit { | |
url = "https://github.com/scylladb/scylla"; |
This is one way of managing your user profile declaratively.
Alternatives include:
- an attrset-based
nix-env
-based environment, installed usingnix-env -ir
rather thannix-env --set
. LnL has an overlay which shows a way of doing this. - home-manager, which provides NixOS-like config for your
$HOME
Note that this is incompatible with regular imperative use of nix-env
, e.g. nix-env -iA nixpkgs.hello
. It has the advantage of allowing the installation of multiple outputs of the same package much better than nix-env
's builtin profile builder does.
OlderNewer