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
@andreasvirkus
andreasvirkus / style.css
Last active March 25, 2021 10:04
Vanilla JS Toast component
.toaster {
display: block;
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: 16px;
width: 100%;
height: 0;
z-index: 11;
}
import Vue from "vue";
function setupWatchers(data = []) {
if (!(this instanceof Vue)) throw new Error("Persistence plugin needs to be called from a Vue component");
if (!data) return;
const query = new URLSearchParams(location.search);
data.forEach((name) => {
const key = `${this.$options.name}_${name}`;
if (query.has(key)) this[name] = JSON.parse(query.get(key));
function buildReport() {
const ss = SpreadsheetApp.getActive();
const data = ss.getSheetByName('SUMMARY').getRange("A1").getValues();
const payload = buildAlert(data);
Logger.log(data);
sendAlert(payload);
}
function buildAlert(data) {
const mrr = data[0][0];
export const ordinal = (num) => {
const suffix = ['th', 'st', 'nd', 'rd']
const value = val % 100
return val + (suffix[(value - 20) % 10] || suffix[value] || suffix[0])
}
const prettier = require("prettier");
const pluginName = "HandleChunkLoadFailurePlugin";
/**
* This Webpack plugin calls `window._chunkHandler.handleVersionChange()` when loading a chunk fails
*/
class HandleChunkLoadFailurePlugin {
constructor(options = {}) {
this.options = Object.assign({}, options);
# Command to check access count per unique IP
tail -n 10000 /var/log/apache2/access.log | awk '{print $1}'| sort| uniq -c| sort -nr| head -n 10
# Command to check access per unique pathname
awk {'print $7'} /var/log/apache2/access.log | sort -nk1 | uniq -c | less
SELECT table_schema
AS "Database", SUM(data_length + index_length) / 1024 / 1024
AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
import crypto from 'crypto'
const generateChecksum = str =>
crypto
.createHash('sha256')
.update(str, 'utf8')
.digest('base64')
const script =
'if (localStorage.getItem("theme")) document.documentElement.dataset.theme = localStorage.getItem("theme")'
# 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.