Skip to content

Instantly share code, notes, and snippets.

@eqyiel
eqyiel / readme.md
Created December 11, 2017 04:58 — forked from IOAyman/readme.md
Use yarn with Greenkeeper

Use yarn with Greenkeeper

When using yarn, it will create a yarn.lock lockfile which holds data on your used dependencies. This file also includes hard-typed versions, so should you update your dependencies, the yarn.lock file is basically outdated and needs to be regenerated. While yarn does this automatically, Greenkeeper pull requests that update dependencies as of right now do not do this regeneration, which means you would have to do it manually.

This gist shows you a way how to automatise this step using a Travis CI script.

Prerequisites

  • You use Travis CI and have it build Pull Requests (default behaviour)
  • You have a yarn.lock file in your repository for Travis CI to automatically install yarn (yarn will be added to their default images soon)

Getting started

@eqyiel
eqyiel / webpack.config.js
Last active November 3, 2017 02:21
How to monkeypatch webpack-dev-server ^2.9.3 for use with react-devtools
/**
* webpack.config.js
*/
const webpack = require('webpack');
const path = require('path');
const { stripIndent } = require('common-tags');
module.exports = (env, { p: production }) => ({
...{
nix-repl> mkVal = with lib; let mkIndent = depth: concatStrings (builtins.genList (_: " ") (2 * depth)); in { value, depth ? 0 }: if (value == true) then "true"
else if (value == false) then "false"
else if (isInt value) then (toString value)
else if (isList value) then concatMapStringsSep " " mkVal { inherit value depth; }
else if (isAttrs value) then
(concatStringsSep "\n${mkIndent (depth + 1)}"
([ "{" ] ++ (mapAttrsToList
(attrName: attrValue: "${attrName} = ${mkVal { value = attrValue; depth = depth + 1; }}")
value) ++ [ "\n${mkIndent depth}}\n" ]))
nix-repl> mkVal = with lib; let mkIndent = depth: concatStrings (builtins.genList (_: " ") (2 * depth)); in { value, depth ? 0 }: if (value == true) then "true"
else if (value == false) then "false"
else if (isInt value) then (toString value)
else if (isList value) then concatMapStringsSep " " mkVal { inherit value depth; }
else if (isAttrs value) then
(concatStringsSep "\n${mkIndent (depth + 1)}"
([ " {" ] ++ (mapAttrsToList
(attrName: attrValue: "${attrName} = ${mkVal { value = attrValue; depth = depth + 1; }}")
value) ++ [ "\n${mkIndent depth}}\n" ]))
#!/usr/bin/env bash
# http://docs.aws.amazon.com/cli/latest/reference/ec2/authorize-security-group-ingress.html
# http://docs.aws.amazon.com/cli/latest/reference/ec2/revoke-security-group-ingress.html
set -euo pipefail
fatal() {
echo '** ERROR:' "$@" >&2
exit 1
eqyiel@ayanami ~/git/personal/deployments/nixpkgs (git)-[networkmanager_openvpn-1.8.0] % nix-shell -p nox --pure --run "nox-review wip"
these paths will be fetched (0.64 MiB download, 3.07 MiB unpacked):
/nix/store/123lmjzg7whdbf4m6zxwym2bg3hcmb67-bash-4.4-p12-doc
/nix/store/370haf2vmf3yc4qp190782jw7b5x6kbd-bash-4.4-p12-man
/nix/store/6vx513kxy6r1cmqs3kqn64x9wrkrsx1z-nox-0.0.5
/nix/store/h9f8mxgy1f44k2lqdzzsxhbdir58qdwd-bash-4.4-p12-info
/nix/store/l0m604kap49r6lg015s8f4vmrriiibam-python3.6-characteristic-14.3.0
/nix/store/mw8m4gd7nx1998fwzabx8yw8pp8ynfsn-python3.6-click-6.7
/nix/store/zknf8wcl6smskiy6l7k5yk55i3xi241q-python3.6-dogpile.cache-0.6.4
fetching path ‘/nix/store/123lmjzg7whdbf4m6zxwym2bg3hcmb67-bash-4.4-p12-doc’...
eqyiel@ayanami ~/git/personal/deployments/nixpkgs (git)-[networkmanager_openvpn-1.8.0] % git reset HEAD~1
Unstaged changes after reset:
M pkgs/tools/networking/network-manager/openvpn.nix
eqyiel@ayanami ~/git/personal/deployments/nixpkgs (git)-[networkmanager_openvpn-1.8.0] % nix-shell -p nox --run "nox-review wip" Usage: nox-review [OPTIONS] COMMAND [ARGS]...
Error: No such command "wip".
2 eqyiel@ayanami ~/git/personal/deployments/nixpkgs (git)-[networkmanager_openvpn-1.8.0] % git status :(
On branch networkmanager_openvpn-1.8.0
Your branch is up-to-date with 'upstream/master'.
eqyiel@ayanami /etc/nixos/nixpkgs (git)-[4e5f2a4...] % echo $NIX_PATH
nixpkgs=/etc/nixos/nixpkgs:nixos-config=/etc/nixos/configuration.nix
eqyiel@ayanami /etc/nixos/nixpkgs (git)-[4e5f2a4...] % git show HEAD
commit 4e5f2a4d160ac0dfdf57644e583b6f34c0ff4a38 (HEAD)
Author: Ruben Maher <r@rkm.id.au>
Date: Mon Sep 18 19:12:40 2017 +0930
nfs-utils: set /etc/krb5.keytab as default path for rpc-gssd
Currently the `rpc-gssd.service` has a `ConditionPathExists` clause that can
rkm@hanekawa ~/git/mango-chutney/flow-typed (git)-[master] % ./run_def_tests.sh
npm WARN definitions@1.0.0 No description
npm WARN definitions@1.0.0 No repository field.
up to date in 0.846s
> definitions@1.0.0 test /Users/rkm/git/mango-chutney/flow-typed/definitions
> eslint npm/**/test*
@eqyiel
eqyiel / generate.sh
Created September 14, 2017 01:28
Nix expression for generating a build of keystone that won't try writing to node_modules in /nix/store
#!/bin/sh -eu
# You need nix installed to run this:
# https://nixos.org/nix/download.html
export NIX_PATH="nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/d0d905668c010b65795b57afdf7f0360aac6245b.tar.gz"
rm -f default.nix node-env.nix node-packages.nix package.json
cat <<EOF > package.json