Skip to content

Instantly share code, notes, and snippets.

View sergio's full-sized avatar

Sergio Acosta sergio

View GitHub Profile
@sergio
sergio / install-codedeploy-agent.sh
Created June 14, 2019 21:50
Install CodeDeploy-Agent Ubuntu us-west-2 #aws #linux
cd /home/ubuntu
sudo apt-get update
sudo apt-get install ruby wget
wget https://aws-codedeploy-us-west-2.s3.us-west-2.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
rm install
@sergio
sergio / README.md
Last active June 14, 2019 15:20
Install systemd #service on #linux

Create unit file:

MY_SERVICE_NAME=myapp
MY_DESCR=My service description
MY_EXEC=/opt/MY_SERVICE_NAME/bin/MY_SERVICE_NAME

cat << EOF > /etc/systemd/system/$MY_SERVICE_NAME.service
[Unit]
Description=$MY_DESCR
After=network.target
@sergio
sergio / install-awscli.sh
Last active August 19, 2019 19:04
Install aws cli Ubuntu Linux #linux #aws
#!/bin/sh
export LC_ALL=C
sudo apt-get update -y
sudo apt install python3-pip -y
sudo pip3 install --upgrade pip
sudo pip3 install awscli --upgrade
@sergio
sergio / README.md
Last active August 19, 2019 20:26
[update-route53-dns] Update public IP address for an EC2 instance in Route53 #aws #ec2 #bash

Script to update a Route53 DNS record with the assigned public (non-elastic) IP at each reboot.

Installing

  1. Set full hostname (ex. hsmclient01.reachcore.io) as AWS console 'Name' tag.
  2. Create manually a DNS record for hostname resolving to public IP
  3. Assign role with access to Route53 and EC2 (or role with existing "RCioAutoUpdateDNS" policy)
  4. Install aws cli: install-awscli.sh (view gist)
  5. Sudo copy script as /usr/local/bin/update-dns.sh
@sergio
sergio / dotnet core .gitignore
Created January 15, 2019 22:52 — forked from vmandic/dotnet core .gitignore
A default .NET Core project .gitignore file
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
# Visual Studio Code
.vscode
# User-specific files
@sergio
sergio / jqsnippets.sh
Last active December 12, 2018 21:25
jq snippets #javascript #bash #jq #unix
# Get every Name property from every object in the Variables array as a raw string.
cat sat.json | jq '.Variables' | jq -r '.[] | .Name '
@sergio
sergio / webcryptoapi.html
Created October 31, 2018 17:00 — forked from deiu/webcryptoapi.html
Web Crypto API: RSA keygen & export & import & sign & verify & encrypt & decrypt
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
})
@sergio
sergio / main.go
Created August 15, 2018 05:07
Golang Http Server #golang
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", handler)
@sergio
sergio / sed cheatsheet
Created March 29, 2018 18:23 — forked from ssstonebraker/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@sergio
sergio / removeattrs
Created March 20, 2018 14:37
Remove special MacOS attributes #macos #unix
# remove '@' extended attributes
sudo xattr -c SoapUIProjects
# remove '+' extended ACL
chmod -R -N SoapUIProjects