Skip to content

Instantly share code, notes, and snippets.

View mavaddat's full-sized avatar
🏠
Working from home

Mavaddat Javid mavaddat

🏠
Working from home
View GitHub Profile
@slawekzachcial
slawekzachcial / aws-sigv4-ssm-get-parameter.sh
Last active March 26, 2025 03:45
Using CURL to call AWS ReST API, signing request with v4 signature
#!/bin/bash
# Source: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
[[ -n "${AWS_ACCESS_KEY_ID}" ]] || { echo "AWS_ACCESS_KEY_ID required" >&2; exit 1; }
[[ -n "${AWS_SECRET_ACCESS_KEY}" ]] || { echo "AWS_SECRET_ACCESS_KEY required" >&2; exit 1; }
readonly parameterName="SlawekTestParam"
readonly method="POST"
@shreyasminocha
shreyasminocha / regex.css
Created April 23, 2020 15:40
Prism.js regex highlighting stylesheet
.token.language-regex {
color: #4d4d4d;
}
.token.quantifier {
color: #58f;
}
.token.escape,
.token.special-escape {
@glsorre
glsorre / keychain.ps1
Last active May 23, 2022 05:23
Windows Subsystem for Linux: never prompt ssh passphrase again
$credentials = Get-StoredCredential -Target sshpassphrase
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($credentials.Password)
$passphrase = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
C:\Windows\System32\wsl.exe -u [YOUR_WSL_USERNAME] -d [YOUR_DISTRIBUTION] /home/[YOUR_WSL_USERNAME]/wslu/keychain.sh $passphrase
@geotrev
geotrev / rollup.config.js
Last active February 3, 2022 01:02
Jekyll Rollup Config
import { terser } from "rollup-plugin-terser"
import path from "path"
import resolve from "rollup-plugin-node-resolve"
import babel from "rollup-plugin-babel"
import glob from "glob"
const scriptPattern = path.resolve(__dirname, "_scripts/**/!(_)*.js")
const inputs = glob.sync(scriptPattern).reduce((files, input) => {
const parts = input.split("/")
@yano3nora
yano3nora / docker_mail_servers.md
Last active January 24, 2022 19:39
[docker: Mail server container] Mail servers by Docker. #docker
@monkut
monkut / add_python_to_WINDOWS_WSL_ubuntu.md
Created February 13, 2019 13:19
Add python to Windows Subsystem for Linux (WSL) [ubuntu]
@fnky
fnky / ANSI.md
Last active April 28, 2025 14:23
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@jdhitsolutions
jdhitsolutions / ConvertTo-Markdown.ps1
Created August 15, 2018 14:50
Convert pipeline output to a markdown document
#requires -version 5.0
Function ConvertTo-Markdown {
<#
.Synopsis
Convert pipeline output to a markdown document.
.Description
This command is designed to accept pipelined output and create a markdown document. The pipeline output will formatted as a text block. You can optionally define a title, content to appear before the output and content to appear after the output.
The command does not create a text file. You need to pipe results from this command to a cmdlet like Out-File or Set-Content. See examples.
.Parameter Title
@BiviaBen
BiviaBen / pubapi_docs.html
Last active August 18, 2021 10:15
Chess.com Published-Data API
<ul style="font-size: 10pt">
<li>Last reviewed and updated: 2017-11-05</li>
<li>Comments: <a href="https://www.chess.com/news/view/published-data-api#comments">https://www.chess.com/news/view/published-data-api#comments</a></li>
<li>Revisions: <a href="https://gist.github.com/BiviaBen/87bd7f830b6f1a8ba6b537f4e0c87e95/revisions">https://gist.github.com/BiviaBen/87bd7f830b6f1a8ba6b537f4e0c87e95/revisions</a></li>
</ul>
<hr>
<p>The PubAPI is a read-only REST API that responds with JSON-LD data. Our goal is to re-package all currently public data from the website and make it available via the PubAPI. "Public Data" is information available to people who are not logged in, such as player data, game data, and club/tournament information. This excludes private information that is restricted to the logged in user, such as game chat and conditional moves.</p>
<p>This is read-only data. You cannot send game-moves or other commands to Chess.com from this system. If you wish to send commands, you will be int
@rafaelsq
rafaelsq / svg_to_png.js
Last active October 25, 2021 22:02
SVG to Base64 PNG
function svg_to_png(svg, callback) {
var svgData = (new XMLSerializer()).serializeToString(svg);
var canvas = document.createElement("canvas");
var svgSize = svg.getBoundingClientRect();
canvas.width = svgSize.width;
canvas.height = svgSize.height;
var ctx = canvas.getContext("2d");
var img = document.createElement("img");