Skip to content

Instantly share code, notes, and snippets.

View andreasvirkus's full-sized avatar
🙊
made you look

andreas andreasvirkus

🙊
made you look
View GitHub Profile
# Prune all log files whose modified time is older than 6 days
find /var/log -mindepth 1 -mtime +5 -delete
@andreasvirkus
andreasvirkus / background-pattern.svg
Last active November 2, 2020 16:07
background-pattern.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
for f in cis-*; do mv "$f" "CL${f#cis-}"; done
export const timeSinceNow = (timestamp) => {
const current = new Date()
const previous = new Date(timestamp * 1000)
const msPerMinute = 60 * 1000
const msPerHour = msPerMinute * 60
const msPerDay = msPerHour * 24
const msPerMonth = msPerDay * 30
const msPerYear = msPerDay * 365
const elapsed = current - previous
brew install docker docker-machine$ brew cask install virtualbox
docker-machine create --driver virtualbox default
docker-machine env default
eval "$(docker-machine env default)"
docker run hello-world
docker-machine stop default
@andreasvirkus
andreasvirkus / README.md
Created May 11, 2020 09:00
A lightweight Deno server using Oak.

Deno server

A lightweight deno server that runs on oak.

Run it with deno --allow-net server.ts

@andreasvirkus
andreasvirkus / service-worker.js
Created April 28, 2020 16:00
SW for vue-cli with Google's workbox
// eslint-disable-next-line no-undef
workbox.setConfig({
debug: false
})
workbox.core.skipWaiting()
workbox.precaching.precacheAndRoute([])
workbox.routing.registerRoute(
@andreasvirkus
andreasvirkus / base.css
Last active December 8, 2020 03:24
When I'm too lazy to set up Tailwind and PurgeCSS for a prototype or a small project, then this will do.
/* Handicraft reset */
*,
*::before,
*::after {
box-sizing: inherit;
}
html {
box-sizing: border-box;
}
body {
@andreasvirkus
andreasvirkus / MasterList.vue
Created April 15, 2020 13:32
Demonstrating recursive Vue components
<template>
<div id="app">
<nested-list
v-for="item in list"
:key="item.name"
:name="item.name"
:items="item.items"
:level="0"
/>
</div>
export const strip = html => {
const doc = new DOMParser().parseFromString(html, 'text/html')
return (doc.body.textContent || '').trim()
}