Skip to content

Instantly share code, notes, and snippets.

@Gerst20051
Gerst20051 / gitlab-graphql-console-script.js
Last active August 19, 2022 23:05
GitLab GraphQL Console Script
(async () => {
const gitlabHost = window.location.host;
const gitlabUser = 'andrew';
const workingDirPath = '~/Desktop';
const snippetDirName = 'gitlab-snippets';
const getSnippetInfoForIds = async ids => {
const rawResponse = await fetch(`https://${gitlabHost}/api/graphql`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@Gerst20051
Gerst20051 / github-gpg-key-setup.sh
Created July 24, 2022 12:38
Automate GitHub GPG Key Setup
#!/usr/bin/env sh
# ASCII: http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Create%20Github%20GPG%20Key
# SOURCE: https://gist.github.com/Gerst20051/
function double_echo {
echo && echo
}
function newline {
@Gerst20051
Gerst20051 / github-ssh-key-setup.sh
Last active July 24, 2022 12:32
Automate GitHub SSH Key Setup
#!/usr/bin/env sh
# ASCII: http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Create%20Github%20SSH%20Key
# SOURCE: https://gist.github.com/Gerst20051/3add6fe949b7eef6b4957e5b7d3707c6
github_ssh_key_directory=${1:-~/.ssh}
github_ssh_key_name=${2:-github_ed25519}
email_address=$3 # optional param - this will be prompted for if not provided
if [ $# -gt 0 ] && (($# < 2 || $# > 3)); then
@Gerst20051
Gerst20051 / macmini-preprovision-script.sh
Last active July 24, 2022 12:22
MacMini Preprovision Script
#!/usr/bin/env sh
# ASCII: http://patorjk.com/software/taag/#p=display&f=Graffiti&t=MacMini%20Preprovision
# SOURCE: https://gist.github.com/Gerst20051/1028d2ed1ca8de80afe5144e5188c745
playbook_repo_name='MacMini-Ansible-Playbook'
playbook_repo_url="git@github.com:Gerst20051/$playbook_repo_name.git"
playbook_repo_directory="$HOME/$playbook_repo_name"
secrets_repo_name='Ansible-Playbook-Secrets'
secrets_repo_url="git@github.com:Gerst20051/$playbook_repo_name.git"
@Gerst20051
Gerst20051 / .snowsql.config.default.clean.ini
Last active April 11, 2022 17:49
Default SnowSQL Config File ~/.snowsql/config
[connections]
[connections.example]
accountname = accountname
username = username
password = password1234
[options]
auto_completion = True
log_file = ../snowsql_rt.log
@Gerst20051
Gerst20051 / ReactingNodes.js
Last active April 8, 2022 10:38
Reacting Nodes
// https://onecompiler.com/javascript/3xyh52rrn
class ReactingNodes {
#nodes = {};
node(component) {
return [this.#nodes[component], component in this.#nodes, this.update(component)];
}
update(component) {
@Gerst20051
Gerst20051 / unflatten.php
Last active March 3, 2022 17:26
PHP Unflatten Dot Notation Array
<?
$results = [
'id' => 'abc123',
'address.id' => 'def456',
'address.coordinates.lat' => '12.345',
'address.coordinates.lng' => '67.89',
'address.coordinates.geo.accurate' => true,
];
function evaluate(context) {
const request = context.getAllRequests().filter(request => {
const name = request.name.includes('token:password');
const exchange = request.getLastExchange();
if (name && exchange) {
const date = exchange.date;
const typePassword = exchange.requestBody.includes('grant_type=password');
const typeRefresh = exchange.requestBody.includes('grant_type=refresh_token');
return date && (typePassword || typeRefresh);
}
@Gerst20051
Gerst20051 / build_and_archive.sh
Created November 22, 2016 19:32
Build And Archive IPA Bash Script
#!/bin/bash
echo ''
################################# PROMPT #################################
itunesconnect_user='email@email.com'
printf "itunesconnect password for email '$itunesconnect_user': "
read -s itunesconnect_pass
##########################################################################
@Gerst20051
Gerst20051 / email_regex.js
Last active September 14, 2021 08:30
Email Regex Validation
(email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) || 'Invalid Email';
const emails = [
[0, ' simple@example.com', 'a valid address with a leading space'],
[0, '.email@test.com', 'a . is not allowed at the beginning and/or end'],
[0, '1234567890123456789012345678901234567890123456789012345678901234+x@example.com', 'too long'],
[0, '@@@', 'only one @ is allowed outside quotation marks'],
[0, 'a"b(c)d,e:f;g<h>i[j\k]l@example.com', 'none of the special characters in this local-part are allowed outside quotation marks'],
[0, 'A@b@c@example.com', 'only one @ is allowed outside quotation marks'],
[0, 'Abc.example.com', 'no @ character'],