sequenceDiagram
autonumber
participant Client
participant Server
participant CA as Certificate Authority
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
const textarea = document.querySelector('textarea[name="pull_request[body]"]'); | |
const text = textarea.value; | |
const lines = text.split("\n") | |
const images = lines.filter(line => { | |
return line.includes("https://user-images"); | |
}); | |
let output = ''; | |
let imgs = images.map(image => { | |
const match = image.match(/\((.*?)\)/); |
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 A | |
def public_message | |
protected_message | |
end | |
def self_protected_message | |
self.protected_message | |
end | |
def self_private_message |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset=utf-8> | |
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name=viewport> | |
<title>Offline for maintenance | ehochef.com </title> | |
<link rel="shortcut icon" type="image/x-icon" href="https://eho-production.s3-eu-west-1.amazonaws.com/maintenance/favicon.ico"> | |
<style> | |
html, | |
body { |
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 RPi.GPIO as GPIO | |
import time | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(7,GPIO.OUT) | |
# https://www.youtube.com/watch?v=ddlDgUymbxc | |
# SG90 angle and pulse width | |
# 0: 0.5 ms | |
# neutral: 1.5 ms |
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
# example.com => www.example.com | |
match '(*any)', to: redirect(subdomain: 'www'), via: :all, constraints: { subdomain: false } | |
# www.example.com => example.com | |
match '(*any)', to: redirect(subdomain: false), via: :all, constraints: {subdomain: 'www'} | |
# caveat | |
# subdomain is anything from 3rd level domain, so for example.co.uk domains the syntax will be the following: | |
# example.co.uk => www.example.co.uk | |
match '(*any)', to: redirect(subdomain: 'www.example'), via: :all, constraints: { subdomain: 'example' } | |
# www.example.co.uk => example.co.uk |
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 | |
BACKUP_DIR="/home/dumps/" | |
S3_PATH="s3://sunbury-dental-production/dumps/" | |
# create a dump | |
mysqldump -u$DB_USER -p$DB_PASSWORD dental_production > /home/dumps/production_dump_$(date +\%m\%d\%y).sql | |
# delete old dumps | |
find $BACKUP_DIR -type f -name "mysql_dump_*.sql.gz" -mtime +10 -daystart | xargs rm -rf |
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
time = ARGV[0] | |
dry_run = ARGV[1] == '--dry' | |
puts "Killing stale servers older than #{time}" | |
puts "***DRY RUN***" if dry_run | |
output = `for i in {1..36}; do echo web$i; ssh deploy@web$i.housetrip.com "ps aux | grep [R]ack" | grep -v "#{time}" | awk '{ print $2 }'; done` | |
server = nil | |
output.split("\n").each do |line| |
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
#!/usr/local/bin/ruby | |
grep = `git grep -n #{ARGV[0]}` | |
puts "\n-----------------------------------------------------------" | |
puts "GREP RESULT" | |
puts '-----------------------------------------------------------' | |
puts grep | |
files = grep.scan /.*\:\d+/ |
NewerOlder