This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /etc/systemd/system | |
sudo vim puma.service | |
# add the follwing code to the above file: | |
--------------------------------------------------------------------------------------- | |
[Unit] | |
Description=Puma HTTP Server | |
After=network.target ?? | |
[Service] | |
Type=simple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
connect = boto3.client("connect") | |
def lambda_handler(event, context): | |
destinationNo = event['destinationNo'] | |
response = connect.start_outbound_voice_contact( | |
DestinationPhoneNumber=destinationNo, | |
ContactFlowId="5bcb4f57-0d7a-4ff0-9147-34134b74efd2", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USEDMEMORY=$(free -m | awk 'NR==2{printf "%.2f\t", $3*100/$2 }') | |
TCP_CONN=$(netstat -an | wc -l) | |
TCP_CONN_PORT_80=$(netstat -an | grep 80 | wc -l) | |
USERS=$(uptime |awk '{ print $6 }') | |
IO_WAIT=$(iostat | awk 'NR==4 {print $5}') | |
aws cloudwatch put-metric-data --metric-name memory-usage --dimensions AutoScalingGroupName=RailsAlpha --namespace "Custom" --value $USEDMEMORY --region us-west-2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
850,3,3,4500000 | |
1000,4,4,3500000 | |
585,3,3,3100000 | |
801,4,4,5500000 | |
729,4,3,4200000 | |
776,4,3,4500000 | |
700,2,3,7100000 | |
800,4,3,4400000 | |
1500,3,5,10000000 | |
1800,3,4,7500000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install -y curl | |
curl -sL https://deb.nodesource.com/setup_8.x | bash - | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | |
apt-get update | |
apt-get install -y libmysqlclient-dev | |
apt-get install -y mysql-client | |
apt-get install -y imagemagick | |
apt-get install -y imagemagick-common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rotator | |
attr_accessor :id, :values | |
BASE = 10 | |
def initialize(id, values) | |
@id = id | |
@values = values | |
end | |
def rotate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "csv" | |
require "byebug" | |
class ParseCSV | |
attr_reader :file, :store, :table | |
def initialize(file_path) | |
@file = CSV.read(file_path, headers: true, row_sep: :auto) | |
@table = CSV.read("table.csv", headers: true, row_sep: :auto) | |
@store = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PER_1 = 20 | |
PER_2 = 35 | |
PER_3 = 45 | |
POOL_SIZE = 10 | |
ids = [*(1..1000)] | |
a1 = (PER_1 / POOL_SIZE).ceil | |
a2 = (PER_2 / POOL_SIZE).ceil | |
a3 = POOL_SIZE - a1 - a2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "zlib" | |
# total percentage = 100 | |
PER_1 = 20 | |
PER_2 = 30 | |
PER_3 = 50 | |
ids = [*(1..1000)].map(&:to_s) | |
libs = [] |
NewerOlder