Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@timrprobocom
timrprobocom / AveryLabels.py
Last active March 13, 2024 18:18
A class to manage printing on Avery labels with ReportLab
import os
from collections.abc import Iterator
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import LETTER, landscape
from reportlab.lib.units import inch
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
# Usage:
# label = AveryLabels.AveryLabel(5160)
@LeviSnoot
LeviSnoot / discord-timestamps.md
Last active April 23, 2024 02:05
Discord Timestamp Syntax

Discord Timestamps

Discord timestamps can be useful for specifying a date/time across multiple users time zones. They work with the Unix Timestamp format and can be posted by regular users as well as bots and applications.

The Epoch Unix Time Stamp Converter is a good way to quickly generate a timestamp. For the examples below I will be using the Time Stamp of 1543392060, which represents November 28th, 2018 at 09:01:00 hours for my local time zone (GMT+0100 Central European Standard Time).

Formatting

Style Input Output (12-hour clock) Output (24-hour clock)
Default <t:1543392060> November 28, 2018 9:01 AM 28 November 2018 09:01
import SwiftUI
struct ContentView: View {
static var toggle = false
static let settings: [Setting] = [
.push(
label: "Embedded content",
[
.text(label: "Deeper!", "Here is some embedded informational text")
]
@tarecord
tarecord / .git_commit_template
Created January 14, 2021 20:14
A template to help you write better commits
######## Subject Line (50 characters) ############
# - Use the imperative mood (imagine the words "This will")
# - Capitalize the first letter
# - Limit to 50 characters
# - Do not end the subject line with a period
######## The Body (72 characters per line) #############################
# - Add line breaks so each line is a maximum of 72 characters
@tranquan
tranquan / xcode-keybindings-as-vscode.md
Last active April 18, 2024 12:42
Xcode KeyBindings as VSCode
@payam-int
payam-int / gist:edf977c6af603fee0ce1b05da7792fe7
Last active April 19, 2024 22:26
Prometheus Node Exporter - CPU and Memory Usage

CPU Usage :

(1 - avg(irate(node_cpu_seconds_total{mode="idle"}[10m])) by (instance)) * 100

Memory Usage :

100 * (1 - ((avg_over_time(node_memory_MemFree_bytes[10m]) + avg_over_time(node_memory_Cached_bytes[10m]) + avg_over_time(node_memory_Buffers_bytes[10m])) / avg_over_time(node_memory_MemTotal_bytes[10m])))
@frank-dspeed
frank-dspeed / get-es-path.mjs
Created January 23, 2020 09:54
Method to get Current File Path inside ESM
//import.meta.url
function getPath(url) {
let result = new URL(import.meta.url)
let pathname = result.pathname
let pathArray = pathname.split('/')
let basename = pathArray.pop()
let dirname = pathArray.join('/')
return { pathname, dirname,basename}
}
@dodying
dodying / favicon.md
Last active April 12, 2024 12:47
[Get Favicon] #api #favicon
  • DuckDuckGo https://icons.duckduckgo.com/ip2/{hostname}.ico
  • Google https://www.google.com/s2/favicons?domain_url={hostname}
  • Yandex https://favicon.yandex.net/favicon/{hostname1}/{hostname2}/
  • allesedv https://f1.allesedv.com/16/{hostname}
  • http://grab-favicons.herokuapp.com/api/v1/grab-favicons/?url={hostname}
  • https://besticon-demo.herokuapp.com/icon?url={hostname}&size=80..120..200
  • http://favicongrabber.com/service-api-reference
@bmaupin
bmaupin / free-database-hosting.md
Last active April 22, 2024 15:09
Free database hosting
@tomac4t
tomac4t / remove-google-tracking.user.js
Last active July 29, 2023 03:45 — forked from k-barton/remove-google-tracking.user.js
Greasemonkey user script: Remove Google's link tracking
// ==UserScript==
// @name Remove Google's link tracking
// @description Removes onmousedown event from external Google links to allow direct links
// @namespace https://gist.github.com/k-barton
// @include https://www.google.com/search*
// @version 0.2.0
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
(function () {