Skip to content

Instantly share code, notes, and snippets.

View ultim8k's full-sized avatar
🛠️
Rock & roll!

Kostas Kapenekakis ultim8k

🛠️
Rock & roll!
View GitHub Profile
@jlpouffier
jlpouffier / available_updates.yaml
Created August 18, 2023 07:26
Home Assistant Hot Tip of the Day: Available Updates
template:
- sensor:
- name: pending_updates
unique_id: pending_updates
state: |
{{
expand(states.update)
| selectattr('state', 'eq', 'on')
| list
| count
type: horizontal-stack
cards:
- type: tile
entity: sensor.living_room_temperature
name: Home
vertical: true
color: primary
icon: mdi:home
tap_action:
action: navigate
import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
import * as tsutils from 'tsutils';
import * as ts from 'typescript';
export const rule = ESLintUtils.RuleCreator.withoutDocs({
meta: {
docs: {
description: 'ban date comparison using ==, ===, !=, !==',
recommended: 'warn',
},
@ryancharris
ryancharris / Base64.sol
Created January 23, 2022 00:22
Solidity Base64 utilities
pragma solidity >=0.8.0 <0.9.0;
// SPDX-License-Identifier: MIT
/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <brecht@loopring.org>
library Base64 {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
function CopyButton({ value }) {
let [copied, setCopied] = React.useState();
let hydrated = usePageIsHydrated();
React.useEffect(() => {
let id = setTimeout(() => setCopied(false), 2000);
return () => clearTimeout(id);
}, [copied]);
return (
<button
@stubar
stubar / preq.js
Created October 1, 2019 10:50
Pull Request Generator
#! /usr/bin/env node
const execSync = require('child_process').execSync;
const changeCase = require('change-case');
/*
Automates creation of Eurostar PRs.
You need to install https://hub.github.com/ for this to work.
Auto adds jira link if one is found in branch name.
PR name is sourced from branch name.
Opens PR in browser for further editing of title / description

Create a TPM-protected SSH key

Windows

Ensure TPM is available

tpm.msc

Create a private key in the TPM

@rosell-dk
rosell-dk / eu_cookie_banner.js
Last active June 4, 2022 15:30 — forked from bavington/eu_cookie_banner.js
Simple EU Cookie Law Banner JavaScript

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,