Skip to content

Instantly share code, notes, and snippets.

View scicco's full-sized avatar

scicco

View GitHub Profile
@scicco
scicco / list_aws_certificates
Created August 2, 2018 07:52
list aws certificates
aws acm list-certificates --profile=<profile_name>
@scicco
scicco / generate_dhparam.pem
Created June 26, 2018 08:15
generate dhparam.pem file
openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
@scicco
scicco / nginx_puma_rails_app.conf
Last active May 30, 2018 13:57
nginx + rails + puma + letsencrypt
#
#/etc/nginx/sites_available/rails_app
#
upstream rails_app {
server unix:///home/deployer/apps/rails_app/shared/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
#!/bin/bash
for listfile in /var/lib/dpkg/info/*.list.broken; do
#echo ${listfile##*/}
listfilename=$(basename -- "$listfile")
listfilename="${listfilename%.*}"
echo "list file name: ${listfilename}"
if [ -f "/var/lib/dpkg/info/${listfilename}" ]; then
output=$(file "/var/lib/dpkg/info/${listfilename}" | awk '{print $2}')
echo $output
#break
#!/bin/bash
for listfile in /var/lib/dpkg/info/*.list; do
listfilename=$(basename -- "$listfile")
listfilename="${listfilename%.*}"
echo ${listfilename}
#break
output=$(file ${listfile}| awk '{print $2}')
#echo "${output}"
if [[ $output == *"data"* ]]; then
echo "${listfile} is DATA!"
git rev-parse --short HEAD
class Data
class << self
def all
(1..10).to_a
end
def created
[4, 5, 6, 8, 9]
@scicco
scicco / using_alias_from_ssh_minus_c
Created February 20, 2018 14:55
using alias when launching command from ssh -c
#found here: https://stackoverflow.com/a/22540192/1488217
# comment out the original line
# [ -z "$PS1" ] && return
if [ -z "$PS1" ]; then
shopt -s expand_aliases
# alias ls='ls --color=always'
# return
fi
@scicco
scicco / tcp_proxy.sh
Created February 20, 2018 14:53
tcp proxy using netcat
#!/bin/sh -e
# found here: https://notes.tweakblogs.net/blog/7955/using-netcat-to-build-a-simple-tcp-proxy-in-linux.html
if [ $# != 3 ]
then
echo "usage: $0 <src-port> <dst-host> <dst-port>"
exit 0
fi
cat log/capistrano.log | egrep "^.+Command:\s(.+)$" | cut -d : -f 2 > log/capistrano_deploy_commands.log