Skip to content

Instantly share code, notes, and snippets.

View tstachl's full-sized avatar

Thomas Stachl tstachl

  • Pilina
  • Remote
View GitHub Profile
@tstachl
tstachl / enable_gpg.sh
Last active October 12, 2022 21:06
This bash script enables GPG, Yubikey and SSH on a nixos live cd for my public key.
#!/run/current-system/sw/bin/sh
nix-env -iA nixos.git nixos.gnupg nixos.pinentry-curses
gpg --receive-keys DE749C31D060A160
echo "$( \
gpg --list-keys \
| grep DE749C31D060A160 -A 1 \
| head -1 | tr -d '[:space:]' \
):6:" | gpg --import-ownertrust;
@tstachl
tstachl / getAnchorBalance.js
Created April 23, 2022 16:51
Google App Script to get Anchor Protocol Earn balance for a terra wallet address.
function getAnchorBalance(addr) {
const contract = 'terra1hzh9vpxhsk8253se0vv5jj6etdvxu3nv8z07zu';
const aUstBalance = JSON.parse(JSON.parse(UrlFetchApp.fetch("https://mantle.terra.dev/?cw20--balance=" + contract, {
method: 'post',
headers: { 'Accept-Encoding': 'gzip, deflate, br', 'Content-Type': 'application/json', 'Accept': 'application/json' },
payload: JSON.stringify({
operationName: null,
variables: {},
query: `{\n ${contract}: WasmContractsContractAddressStore(ContractAddress: \"${contract}\", QueryMsg: \"{\\\"balance\\\":{\\\"address\\\":\\\"${addr}\\\"}}\") {\n Height\n Result\n __typename\n }\n}\n`
})
@tstachl
tstachl / tailscale.sh
Created November 27, 2021 18:37
Proper tailscale install on debian based distros.
#!/usr/bin/env bash
# Everything needs to be run as root
if [ $(id -u) -ne 0 ]; then
printf "Script must be run as root.\n"
exit 1
fi
OS=$(lsb_release -si)
VERSION=$(lsb_release -sc)
require 'desk_api'
DeskApi.configure do |config|
config.username = 'user@example.com'
config.password = 'Example1'
config.endpoint = 'https://sample.desk.com'
end
customer = DeskApi.customers.create({
first_name: 'Test',
@tstachl
tstachl / create_scratch_org
Created May 24, 2018 23:24
Create a new scratch org for SCMT development.
#!/bin/bash
echo "Creating a new scratch org"
sfdx force:org:create -f config/project-scratch-def.json -a $1 --setdefaultusername --durationdays 30
sfdx scmt:audit:enable -u $1
echo "Pushing source"
sfdx force:source:push -f -u $1
sfdx force:user:permset:assign --permsetname SCMT_Audit -u $1
sfdx force:data:record:update -s User -w "firstname='User'" -v "UserPermissionsKnowledgeUser=true" -u $1
sfdx force:org:open -u $1
@tstachl
tstachl / .eslintrc.json
Last active April 24, 2018 12:41
Sane default eslintrc close to Salesforce DX.
{
"env": {
"browser": true
},
"parserOptions": {
"ecmaVersion": 5
},
"globals": {
"$A": true,
"AuraContext": true,
@tstachl
tstachl / Dockerfile
Created February 21, 2018 03:31
A custom Dockerfile to copy a config file into the image.
FROM nginx:alpine
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
@tstachl
tstachl / docker-compose.yml
Created February 21, 2018 02:38
A compose file containing the logging service via logsprout.
version: '3'
services:
logger:
image: gliderlabs/logspout
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
command: "syslog+tls://${PAPERTRAIL_URL}"
restart: always
@tstachl
tstachl / docker-compose.yml
Created February 21, 2018 01:48
File to test Docker Compose.
version: '3'
services:
nginx:
image: nginx:alpine
ports:
- '80:80'
- '443:443'
restart: always
@tstachl
tstachl / authy_ssh.sh
Created February 21, 2018 00:02
Steps to install Authy SSH CLI.
# download the code from github
wget https://raw.githubusercontent.com/authy/authy-ssh/master/authy-ssh
# run the install
sudo bash authy-ssh install /usr/local/bin
# enable it
sudo /usr/local/bin/authy-ssh enable `whoami`
# test it