Skip to content

Instantly share code, notes, and snippets.

View jglodek's full-sized avatar

Jacek Głodek jglodek

  • Iterators
  • Warsaw, Poland
View GitHub Profile
@jglodek
jglodek / gist:049143b8dd938932584507a3fde4e630
Created July 17, 2018 07:59
Generating a list of days before today in Javascript | Sequence of days in Javascript | Date Sequence
function sequence(number) { return Array.apply(null, {length: number}).map(Function.call, Number);};
const begin = moment("2018.05.05", "YYYY.MM.DD");
const today = moment();
const daysCount = moment().diff(begin, "days");
const days = sequence(daysCount + 1).map((dayNo) => {
return moment(today).subtract(dayNo, "days").format("YYYY.MM.DD");
})
@jglodek
jglodek / gist:04fa484833b9c6d5a3d2be9cb43ae312
Last active March 19, 2019 17:23
How to create SSH tunnel for docker and docker for mac to private docker registry secured by SSH tunnel not TLS
//Super straightforward on Linux
sudo ssh -N -o StrictHostKeyChecking=no \
-i ./certs/output/ssh-private-key \
user@private.host \
-L 5000:127.0.0.1:5000
docker login localhost:5000 --username registry_user --password registry_password
// On Docker for Mac docker virtual machine has it's own 127.0.0.1 and can access your macbook localhost only via `host.docker.internal`