Sometimes while running a command inside of a docker container, the container itself will run out of disk space and things can fail (sometimes in strange ways). This is not a guide on how to allocate resources, but a quick cookbook on how to free up disk space inside a container. See below for links to more resources and reading.
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
# Copyright (c) 2016, Swift Navigation, All Rights Reserved. | |
# Released under MIT License. | |
# | |
# Find documentation of parameters here: | |
# http://aprs.gids.nl/nmea/#gga | |
# | |
# time_t is a `time_struct` (https://docs.python.org/2/library/time.html) | |
# alt_m, geoidal_sep_m are in meters | |
import time | |
from math import floor |
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
use text_io::try_read; | |
use std::io; | |
use std::io::prelude::*; | |
use std::cmp::Ordering; | |
use std::fmt; | |
pub enum BST<T: Ord+fmt::Display> { | |
Leaf { | |
value: T, | |
left_child: Box<BST<T>>, |
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
-- can be used in ghci | |
import qualified Data.ByteString as B | |
import Numeric (showHex) | |
import qualified Data.ByteString.Lazy as LBS | |
import qualified Data.Binary as B | |
-- encode some object to a binary ByteString | |
let s = (B.encode someObjectThatHasBinaryInstance) | |
let prettyPrint = P.concatMap ((\x -> "0x"++x++" ") . flip showHex "") . B.unpack :: B.ByteString -> String |
$ clang++ main.cpp -std=c++11 -o main && ./main
Converting red to string: red
Converting 2 to enum to string: yellow
Converting 20 to enum to string: undefined
Converting 20 to enum to int: 20
... and a short description of interesting things learned within:
- 2015-12-25: Beautiful Decay of AOL: someone going over old AOL CDs and "reviewing" the contents of AOL pages.
- 2015-12-25: Specialising Dynamic Techniques for Implementing The Ruby Programming Language: Chris Seaton's PhD thesis - embracing metaprogramming in Ruby to optimize Ruby VMs.
- 2015-12-25: People around the world are eating banana peels because they know something that Westerners do not: basically eating banana peels is better for you and the environment.
- 2015-12-26: Amateur Hour: a guide to how training for beating amateur cycling records works. tl;dr: excruciating, requires intense focus. Train things at 90% of maximum for shorter intervals.
- 2015-12-26: [Attritional Interfaces](https://samgentle.com
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
CREATE OR REPLACE FUNCTION DateDiff (units VARCHAR(30), start_t TIMESTAMP, end_t TIMESTAMP) | |
RETURNS INT AS $$ | |
DECLARE | |
diff_interval INTERVAL; | |
diff INT = 0; | |
years_diff INT = 0; | |
BEGIN | |
IF units IN ('yy', 'yyyy', 'year', 'mm', 'm', 'month') THEN | |
years_diff = DATE_PART('year', end_t) - DATE_PART('year', start_t); | |
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
function transposeMatrix (m) { | |
return m.map((_, c) => m.map(r => r[c])); | |
} | |
console.log(transpose([[1,2,3],[4,5,6],[7,8,9]])); |
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
#!/usr/bin/env node | |
const mode = process.argv[2]; | |
const startDate = process.argv[3]; | |
const endDate = process.argv[4]; | |
const vacationDays = parseInt(process.argv[5], 10); | |
const sugar = require('sugar-date'); | |
const moment = require('moment'); | |
const parsedStartDate = moment(sugar.Date.create(startDate)); |
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
select * from pg_stat_activity; |
NewerOlder