Skip to content

Instantly share code, notes, and snippets.

View madhukar93's full-sized avatar

Madhukar Mishra madhukar93

View GitHub Profile
# open streams
```
stdin_open: true
tty: true
```
# run this to get into console
docker attach <instance>
@CMCDragonkai
CMCDragonkai / nix_overrides.md
Created May 21, 2019 05:43
Nix Overrides #nix

Nix Overrides

  • overrideDerivation is used to override the call to derivation
  • overrideAttrs is used to override the call to stdenv.mkDerivation
  • override is used to override the last function call. Often this will be the callPackage call.
  • overridePythonAttrs is used to override the call to buildPython*.

This PR NixOS/nixpkgs#46842 discusses the idea to have a generic overrideArgs that works like overridePythonAttrs for all language infrastructures.

@CMCDragonkai
CMCDragonkai / nix_store_queries.sh
Last active June 22, 2019 05:51
Nix Store Queries #nix
#!/usr/bin/env sh
# show the output paths of a derivation
nix-store --query --outputs $(nix-instantiate)
# show the immediate dependencies of a derivation
nix-store --query --references $(nix-instantiate)
# show the transitive dependencies of a derivation
nix-store --query --requisites $(nix-instantiate)
# show the dependers of a store-path
nix-store --query --referrers $(nix-instantiate)
@CMCDragonkai
CMCDragonkai / nix_checkphase_calling_project_scripts.md
Created December 10, 2018 04:23
Nix `checkPhase` calling project scripts #nix

Nix checkPhase calling project scripts

When using checkPhase and calling scripts in your project, you may need to run patchShebangs bin prior.

This is because your scripts don't have their shebangs patched, so they may be trying to call /usr/bin/env bash. And this path does not exist inside the Nix build environment.

{
coc-nvim = let
pname = "coc-nvim";
version = "0.0.61";
src = fetchFromGitHub {
owner = "neoclide";
repo = "coc.nvim";
rev = "v${version}";
sha256 = "1as2hb4kfq1m0nq7vp2ibkfq8n219ykr04qx4qadg97s7iky4yx4";
@CMCDragonkai
CMCDragonkai / journey_nix_package_repository.md
Last active April 9, 2020 09:36
Journey into Nix Package Repository #nix

Journey into Nix Package Repository

There are 2 commits that I need in my build:

  • 8d0e3ad603dda85462161bba1351893b84339462
  • 83e01aa5e48a9107f3b988c9d4c1c21d610626fb

Clone nixpkgs and add the nixpkgs-channels as a remote.

@seanf
seanf / jenkins-ensure-timeout.groovy
Last active September 27, 2022 11:00
Jenkins Groovy script: sets a timeout strategy for any job which doesn't have one
// This script is for Jenkins' Groovy console, and sets a timeout
// strategy for any job which doesn't have one.
// Based on http://janmaterne.wordpress.com/2010/07/11/how-to-check-if-all-hudson-jobs-have-a-timeout/
// Updated and modified by Sean Flanigan.
import hudson.model.*
String describe(strat) {
if (strat instanceof hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy) {
return "Elastic(${strat.timeoutPercentage}, ${strat.numberOfBuilds}, ${strat.timeoutMinutesElasticDefault})"
@noahcrowley
noahcrowley / docker-compose.yml
Created June 28, 2018 16:26
TICK Stack Docker Compose for Raspbian
version: '3'
services:
influxdb:
# Full tag list: https://hub.docker.com/r/library/influxdb/tags/
image: influxdb:latest
volumes:
# Mount for influxdb data directory
- ./influxdb/data:/var/lib/influxdb
# Mount for influxdb configuration
- ./influxdb/config/:/etc/influxdb/

Important: At the time of writing (2019-11-11) Immutable.js is effectively abandonware, so I can no longer recommend anyone to follow the advice given here. I'll leave the article here for posterity, since it's still getting some traffic.

Understanding Immutable.Record

Functional programming principles and with it immutable data are changing the way we write frontend applications. If the recent de-facto frontend stack of React and Redux feels like it goes perfectly together with immutable data, that's because it's specifically designed for that.

There's several interesting implementations of immutable data for JavaScript, but here I'll be focusing on Facebook's own Immutable.js, and specifically on one of i

@chandlerprall
chandlerprall / threaded_download.py
Created June 9, 2011 17:41
Small Python multi-threaded file downloader
import urllib2
import threading
from Queue import Queue
import sys, os, re
class ThreadedDownload(object):
REGEX = {
'hostname_strip':re.compile('.*\..*?/', re.I)
}