Skip to content

Instantly share code, notes, and snippets.

{ writeScriptBin, runCommand, xterm }:
let
nixposition = writeScriptBin "nix-position" ''
nix-position () {
usage () {
echo "Usage: nix-position <attribute-path-under-pkgs>"
echo "Shows the Nix source file for a given attribute path."
}
if [ $# -ne 1 ]; then usage; return -1; fi
@samgiles
samgiles / async-streams-and-promises.js
Last active October 6, 2017 00:04
Returning a Stream in a Promise is an anti-pattern.
/** Method 1. Use a PassThrough stream */
var PassThrough = require('stream').PassThrough;
function myAsyncContent() {
var myContentStream = new PassThrough();
var streamPromise = getAsyncInfo().then(function(info) {
return createStreamFromInfo(info);
});
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p jq less
nix-instantiate --eval --strict -E 'map (x: x.name) (import <nixpkgs/nixos> {}).config.environment.systemPackages' --json | jq -r '.[]' | sort -u | less
rec {
test1 = builtins.scopedImport { __nixPath = [ { path = test4; prefix="ssh-config-file"; } ] ++ __nixPath; };
test2 = test1 <nixpkgs/pkgs/build-support/fetchgit/private.nix>;
pkgs = import <nixpkgs> {};
test3 = pkgs.callPackage test2 {};
test4 = pkgs.writeText "sshd_config" ''
# empty file, use programs.ssh.knownHosts in configuration.nix not StrictHostKeyChecking no
'';
test5 = test3 {
url = "git@github.com:cleverca22/not-os.git";
@LnL7
LnL7 / configure.sh
Last active June 9, 2020 20:13
darwin nix-daemon distributed builds
#!/usr/bin/env bash
sudo mkdir -p /run/nix/current-load
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo curl -fsSL -o /Library/LaunchDaemons/org.nixos.nix-daemon.plist https://gist.github.com/LnL7/ba2eac19e77cd6b4bb02c8de03bf5f4e/raw/69722c2b13c4eb022a1312cd6891838b413e1f96/org.nixos.nix-daemon.plist
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist
# Configure /etc/nix/machines
# Make sure root can ssh to the builder (known_hosts etc.)
@hilkeheremans
hilkeheremans / howto
Last active December 8, 2020 19:20
Fonts in React Native for Android vs iOS
REACT NATIVE IOS vs ANDROID FONT USE
Tested for React Native 0.41+
IOS:
- Place the fonts in the assets and make sure they are bundled along
- On iOS, fontFamily in Text match the Font Family name as described in Font Book (macOS). Font weights can be specified exactly.
ANDROID:
On Android, there are two ways of using fonts:
@DamienCassou
DamienCassou / configuration.nix
Created October 22, 2014 13:41
configuration.nix file for NixOS on my macbook pro
{ config, pkgs, ... }:
let
hostname = "luz3";
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# I use VirtualBox to connect to Windows and Linux guests
@brennanMKE
brennanMKE / README.md
Created October 4, 2016 16:10
React Native on macOS Sierra

React Native Trouble

Updating to macOS Sierra is causing trouble with React Native due to some of the Node.js and system utilities it uses. Specifically the watch utility fails due to a limit on the number of files which can be opened at a time.

The following command shows the current limit.

launchctl limit maxfiles
@jlbruno
jlbruno / ordinal.js
Last active July 28, 2022 14:58
Javascript Ordinal Numbers
// found here http://forums.shopify.com/categories/2/posts/29259
var getOrdinal = function(n) {
var s=["th","st","nd","rd"],
v=n%100;
return n+(s[(v-20)%10]||s[v]||s[0]);
}
@mugi-uno
mugi-uno / remote-work-style-check.md
Last active October 10, 2022 11:26
リモートワークスタイルチェック

リモートワークスタイルチェック

昨今の社会情勢の影響もありリモートワークを導入する企業・チームが増えてきましたが、 一口に「リモートワーク」といってもさまざまなスタイルがあります。

企業側と働く側のミスマッチを防ぐため、リモートワークにおける観点を列挙してみました。

リモートワーク比重度

どの程度リモートワークに比重を置いて導入しているかのチェックリストです。