Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
# poor-man's rollup | |
# rollups like in SQL: GROUP BY ROLLUP(...) | |
# example: | |
# d = data.frame(x=trunc(runif(25, 1, 10)), y=trunc(runif(25, 1, 5)), z=rnorm(25)) | |
# result = pmr(d, .(x, y, j=x / 2), summarise, p=sum(z), .labels=list(x='-900', y='Total')) | |
require(plyr) | |
pmr = function(.data, .variables, ..., |
###################################################################### | |
# CURRENT AWARE LOCAL DATETIME | |
###################################################################### | |
from datetime import datetime | |
from tzlocal import get_localzone | |
local_tz = get_localzone() | |
local_dt = datetime.now(local_tz) |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
library(shiny) | |
shinyServer(function(input, output, session) { | |
# The number of iterations to perform | |
maxIter <- 50 | |
# Track the start and elapsed time | |
startTime <- Sys.time() | |
output$elapsed <- renderText({ |
import zmq | |
import unittest | |
from unittest.mock import patch | |
from unittest.mock import MagicMock | |
class MockZmqSocket(MagicMock): | |
def __init__(self, **kwds): | |
super().__init__(**kwds) |
import requests | |
import re | |
session = requests.Session() | |
# This isn't your Telstra ID but rather the Fon credentials found in the Telstra Air app, you can also find this in the network tab of inspect element when logging in normally. | |
anid = "[email protected]" | |
anidpassword = "" | |
try: login = re.findall(r'<LoginURL>(.*)</LoginURL>', session.get("http://msftconnecttest.com/redirect").text)[0] # Get the Telstra Air login URL |
---Utility for keymap creation. | |
---@param lhs string | |
---@param rhs string|function | |
---@param opts string|table | |
---@param mode? string|string[] | |
local function keymap(lhs, rhs, opts, mode) | |
opts = type(opts) == 'string' and { desc = opts } | |
or vim.tbl_extend('error', opts --[[@as table]], { buffer = bufnr }) | |
mode = mode or 'n' | |
vim.keymap.set(mode, lhs, rhs, opts) |