Skip to content

Instantly share code, notes, and snippets.

View Strajk's full-sized avatar
🐣
knock knock…

Pavel 'Strajk' Dolecek Strajk

🐣
knock knock…
View GitHub Profile
@ciiqr
ciiqr / zod-optional-null.ts
Last active April 17, 2024 13:44
zod optional/nullable/nullish differences
// zod schema
z.object({
// valid if string or:
optional: z.string().optional(), // field not provided, or explicitly `undefined`
nullable: z.string().nullable(), // field explicitly `null`
nullish: z.string().nullish(), // field not provided, explicitly `null`, or explicitly `undefined`
});
// type
{
@ValentaTomas
ValentaTomas / identity.ts
Last active September 21, 2023 08:29
Identify function
export function identity<T>(item: T) {
return item
}
@tuansoibk
tuansoibk / cryptography-file-formats.md
Last active April 15, 2024 17:07
Cryptography material conversion and verification commands
  1. Introduction
  2. Standards
  3. Common combinations
  4. Conversion
  5. Verification/Inspection
  6. Tips for recognising

Introduction

It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.

@Dainius14
Dainius14 / og-developer-sound-pack.user.js
Last active March 5, 2024 08:54
OG Developer Sound Pack
// ==UserScript==
// @name OG Developer Sound Pack
// @namespace https://saldainius.lt
// @downloadUrl https://gist.github.com/Dainius14/8a9d5bfa06458a93a00b8d34111e7e4f/raw/og-developer-sound-pack.user.js
// @updateUrl https://gist.github.com/Dainius14/8a9d5bfa06458a93a00b8d34111e7e4f/raw/og-developer-sound-pack.user.js
// @website https://gist.github.com/Dainius14/8a9d5bfa06458a93a00b8d34111e7e4f/
// @version 1.5.2
// @description Plays sound when interacting with Bitbucket and Jira
// @author Dainius
// @match https://bitbucket.cid-dev.net/projects/*/repos/*/pull-requests/*
@kaushikgopal
kaushikgopal / karabiner.edn
Last active October 13, 2023 21:15
My source Karabiner file in Goku's edn format - Now lives @ https://github.com/kaushikgopal/dotfiles/blob/master/.karabiner.edn
;; File has moved over to https://github.com/kaushikgopal/dotfiles/blob/master/.karabiner.edn
;; Feel free to raise github issues in that repo, if you have questions/comments/edits
@martin-kokos
martin-kokos / Webexpo 2019.md
Last active June 24, 2021 15:37
Webexpo 2019
@yyuu
yyuu / circle.rb
Last active December 7, 2019 13:10
A simple script to convert Circle CI configurations from circle.yml (1.0) to .circleci/config.yml (2.0)
#!/usr/bin/env ruby
require "fileutils"
require "shellwords"
require "yaml"
CIRCLE1_DEFAULT_CACHE_DIRECTORIES = [
"vendor/bundle",
"~/.m2",
"~/.bundle",
@inorganik
inorganik / thunderclap.js
Last active March 31, 2021 08:50
Smash Medium's clap button the max number of times (50) in 1 second
// smash Medium's clap button the max number of times
function simulateClick(node) {
var md = document.createEvent('MouseEvents');
md.initEvent('mousedown', true, false);
node.dispatchEvent(md);
var mu = document.createEvent('MouseEvents');
mu.initEvent('mouseup', true, false);
node.dispatchEvent(mu);
}
@btnwtn
btnwtn / 50.js
Last active September 18, 2019 16:09
Automat dat +50 clapping on Medium.com
(() => {
const up$ = new MouseEvent("mouseup", { bubbles: true });
const down$ = new MouseEvent("mousedown", { bubbles: true });
const node = document.querySelector(
`.js-postActionsFooter button[data-action="multivote"]`
);
let attempts = 0;
@brenopolanski
brenopolanski / npm-list-globally.md
Created November 1, 2016 19:34
Listing globally installed NPM packages and version
npm list -g --depth=0