RESTORE=$(echo -en '\033[0m') | |
RED=$(echo -en '\033[00;31m') | |
GREEN=$(echo -en '\033[00;32m') | |
YELLOW=$(echo -en '\033[00;33m') | |
BLUE=$(echo -en '\033[00;34m') | |
MAGENTA=$(echo -en '\033[00;35m') | |
PURPLE=$(echo -en '\033[00;35m') | |
CYAN=$(echo -en '\033[00;36m') | |
LIGHTGRAY=$(echo -en '\033[00;37m') | |
LRED=$(echo -en '\033[01;31m') |
# This file should be placed at /etc/logrotate.d/ | |
/srv/*/shared/log/*.log { | |
daily | |
missingok | |
dateext | |
rotate 30 # amount of days to keep compressed logs (you should backup it up externally) | |
compress | |
delaycompress | |
notifempty |
I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.
I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.
Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \; |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.
These are the steps I went through to set up an SSL cert.
#!/usr/bin/env ruby | |
module Spreedsheet | |
module ColumnNotation | |
def seed | |
@seed ||= ('A'..'Z').to_a | |
end | |
def position_to_column_notation(num, minus = 0) | |
m = num.divmod(seed.size) |
fn = "filename" | |
compressed_file_name = "#{fn}.gz" | |
Zlib::GzipWriter.open(compressed_file_name) do |gz| | |
gz.mtime = File.mtime(fn) | |
gz.orig_name = fn | |
gz.write IO.binread(fn) | |
end |
#!/usr/bin/env bash | |
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`. | |
# Please modify the CONSTANT variables to fit your configurations. | |
# The script will start with config set by $PUMA_CONFIG_FILE by default | |
PUMA_CONFIG_FILE=config/puma.rb | |
PUMA_PID_FILE=tmp/pids/puma.pid | |
PUMA_SOCKET=tmp/sockets/puma.sock |