Skip to content

Instantly share code, notes, and snippets.

View chtz's full-sized avatar

Chris T. - Dirty Hacks/Evening Hacks/80%-of-80%-Solutions Public Repo chtz

  • CH
View GitHub Profile
@chtz
chtz / aws-route53-changeResourceRecordSets.js
Last active May 11, 2020 07:19
AWS SDK JavaScript update A Record in Route53
const AWS = require('aws-sdk');
const route53 = new AWS.Route53();
await route53.changeResourceRecordSets({
ChangeBatch: {
Changes: [
{
Action: "UPSERT",
ResourceRecordSet: {
Name: domain,
ResourceRecords: [
@chtz
chtz / node-sha256-hex.js
Created May 11, 2020 07:13
node sha256 as hex string
//npm install hash.js
const hash = require('hash.js')
hash.sha256().update(foo).digest('hex')
@chtz
chtz / serverless-config-from-stage-file.yml
Created May 11, 2020 07:11
serverless.com config value from stage file
${file(config.${self:provider.stage}.yml):foo}
@chtz
chtz / serverless-create-node.sh
Created May 11, 2020 07:08
serverless.com create node project
sls create --template aws-nodejs --path <path>
@chtz
chtz / fritz-dyndns-url-template.txt
Created May 11, 2020 07:06
Fritz.box custom DynDNS URL
https://<host>/<path>?i=<ipaddr>&l=<username>&p=<pass>&h=<domain>
@chtz
chtz / install-cloudwatch-log-agent-amazonlinux2.sh
Created May 22, 2019 21:07
Install AWS CloudWatch log agent on Amazon Linux 2
#!/bin/bash
# Pre cond:
#
# EC2 IAM role with this IAM policy:
# {
# "Version": "2012-10-17",
# "Statement": [
# {
# "Effect": "Allow",
@chtz
chtz / artifactory_deploy.rb
Created March 11, 2018 21:21
Artifactory (4.16.0 / default admin) deployment sample in ruby (no error handling)
require 'nokogiri'
require 'net/http'
ARTIFACTORY_URL = "http://localhost:8081/artifactory/libs-release-local"
ARTIFACTORY_USER = "admin"
ARTIFACTORY_PASS = "password"
TARGET_FOLDER = "target"
def open_pom
@chtz
chtz / artifactory-deploy-curl-sample.sh
Created March 11, 2018 20:28
Deploy jar to artifactory with curl
docker run -d --name artifactory-oss -p 8081:8081 docker.bintray.io/jfrog/artifactory-oss:4.16.0
curl -uadmin:password -T target/backup-0.0.2.jar "http://localhost:8081/artifactory/libs-release-local/ch/furthermore/backup/0.0.2/backup-0.0.2.jar"
curl -uadmin:password -T pom.xml "http://localhost:8081/artifactory/libs-release-local/ch/furthermore/backup/0.0.2/backup-0.0.2.pom"
require 'nokogiri'
def open_pom
File.open("pom.xml") { |f| Nokogiri::XML(f) }
end
def save_pom(pom)
File.open('pom.xml','w') {|f| pom.write_xml_to f}
end
require 'nokogiri'
def open_pom
File.open("pom.xml") { |f| Nokogiri::XML(f) }
end
def save_pom(pom)
File.open('pom.xml','w') {|f| pom.write_xml_to f}
end