Skip to content

Instantly share code, notes, and snippets.

@rafaftahsin
rafaftahsin / main.sh
Last active July 5, 2023 10:00
Size of Total Storage in CodeArtifact in a region
#!/bin/bash
export AWS_PROFILE=profile
domains=$(aws codeartifact list-domains | jq -r ".domains[].name")
total_artifactory_size=0
for d in $domains; do
repos=$(aws codeartifact list-repositories-in-domain --domain $d | jq -r ".repositories[].name")
for r in $repos; do
@rafaftahsin
rafaftahsin / README.md
Created February 20, 2021 18:44 — forked from andrewodri/README.md
Create and Validate an ACM Certificate

This script performs the following actions:

  1. Creates a TLS certificate in ACM
  2. Upserts a validation CNAME record in Route 53
  3. Waits for the validation CNAME record to complete/update
  4. Waits for the certificate to validate and issue
  5. Outputs a description of the certificate

This obviously assumes that your domain's DNS is hosted on Route 53. It also uses the AWS credentials and region for the environment it is executed in.

@rafaftahsin
rafaftahsin / SeedData.cs
Created November 20, 2018 05:14
SqliteDB to PostGRE Database seeding with C# ASP.NET Core 2.1 MVC
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace SqliteToPostGre.Models
{
public class SeedData
stage('Stage Name') {
steps {
build(job: 'pipeline.name', parameters: [string(name: 'DEPLOY_TO', value: "test")])
}
}
@rafaftahsin
rafaftahsin / syncFilesystemToImage.sh
Created December 20, 2017 09:44 — forked from geoffreyanderson/syncFilesystemToImage.sh
A script to rsync a running Linux OS to an image file (specifically, a 10GB image file for deployment to AWS EC2).
#!/bin/bash
# Run this script on a running Linux OS that you want to be put into an image file.
# Ensure that the system you run this on is less than 10GB in size if you wish to
# deploy the image file to AWS EC2.
# Note: This is based on Michael Fairchild's instance-to-ebs-ami.sh script.
# -https://gist.github.com/249915
imageFile=${1:-"awsImage-$(date +%m%d%y-%H%M).img"}
imageMountPoint=${2:-'/mnt/image'}
extraFilesArchive=${3:-'awsInstanceFiles.tar.gz'}
# https://www.youtube.com/watch?v=PwAGxqrXSCs&index=47&list=PLQVvvaa0QuDfKTOs3Keq_kaG2P55YRn5v
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("tmp/data/", one_hot=True)
n_nodes_hl1 = 500
n_nodes_hl2 = 500
n_nodes_hl3 = 500
# Not Completed Yet
--------------------------------------------------------------------------------
WORKING WITH SERVICE
--------------------------------------------------------------------------------
systemctl stop servicename # Stop a running service
systemctl start service #Start a service
systemctl restart service #Restart a running service
systemctl reload service #Reload all config files in service
@rafaftahsin
rafaftahsin / bash-cheatsheet.sh
Created December 27, 2016 04:24 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@rafaftahsin
rafaftahsin / Dockerfile
Created October 19, 2016 06:34 — forked from ju2wheels/Dockerfile
Docker Dockerfile reference template
# Last updated: 08/24/2916
#
# Total instructions available: 18
#
# https://docs.docker.com/engine/reference/builder/
#
# You can use a .dockerignore file in the same context directory as
# your Dockerfile to ignore files in the context before sending them
# to the Docker daemon for building to speed up building.
┌───────────────────────────┬──────────────────────────┬────────────────────────┬───────────────────────┐
│ │ │ │ │
├───────────────────────────┼──────────────────────────┼────────────────────────┼───────────────────────┤
│ │ │ │ │
├───────────────────────────┼──────────────────────────┼────────────────────────┼───────────────────────┤
│ │ │ │ │
├───────────────────────────┼──────────────────────────┼────────────────────────┼───────────────────────┤
│ │ │ │ │
└───────────────────────────┴──────────────────────────┴────────────────────────┴───────────────────────┘