This file contains 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
instrumentation_mapping[name] = { # Each key is a vcl file | |
'original_content': original_vcl_source_code, | |
'orig_line_count': original_vcl_line_count, | |
'tested_line_count': amount_of_lines_we_tested, # Excluding empty lines, comments, etc.. | |
'tested_line_numbers': original_line_numbers_that_we_test | |
} |
This file contains 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
def add_instrumentation(name, content): | |
lines = content.split('\n') | |
original_line_count = 1 | |
instrumented_lines = [] | |
subroutine_parenthesis_stack = [] | |
sub_tested_line_numbers = [] | |
tested_line_numbers = [] | |
cur_subroutine_decl_line_number = 0 | |
in_subroutine = False | |
in_synthetic = False |
This file contains 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
def get_all_custom_vcls(service_id, version): | |
url = 'https://api.fastly.com/service/{}/version/{}/vcl'.format(service_id, version) | |
response = requests.request('GET', url, headers={...}) | |
return response.json() |
This file contains 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
sub vcl_recv { | |
declare local var.log_8 BOOL; | |
declare local var.log_5 BOOL; | |
declare local var.log_4 BOOL; | |
#FASTLY recv | |
set var.log_4 = true; | |
if (req.request != "HEAD" && req.request != "GET" && req.request != "FASTLYPURGE") { | |
set var.log_5 = true; | |
log "syslog " req.service_id " Px-Instrumentation :: main," + if(var.log_4, "4 ", "") + if(var.log_5, "5 ", ""); | |
return(pass); |
This file contains 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
sub vcl_recv { | |
#FASTLY recv | |
if (req.method != "HEAD" && req.method != "GET" && req.method != "FASTLYPURGE") { | |
return(pass); | |
} | |
return(lookup); | |
} |
This file contains 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/bin/env bash | |
# | |
# Bootstrap script for setting up a new macOS machine | |
# | |
# Based on https://gist.github.com/codeinthehole/26b37efa67041e1307db | |
# | |
echo "##############################" | |
echo "#Welcome to MAC bootstrapper!#" | |
echo "##############################" |
This file contains 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
#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python | |
""" | |
Arazim Crawler | |
Description: A script that crawls arazim website for summaries, if a new summary is found, sends an email notification. | |
Usage: | |
1. pip install requirements: requests, beautifulsoup4 | |
2. place script in desired folder | |
3. put it in crontab (crontab -e) with the contents (*/15 represents every 15 minutes): |
This file contains 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
'use strict'; | |
const logger = require('../libs/logger.lib'); | |
const ErrorLevel = require('../enums/ErrorLevel'); | |
const ErrorLevelInverse = require('../enums/ErrorLevelInverse'); | |
const BaseError = exports.BaseError = class BaseError extends Error { | |
constructor(opts) { | |
let message = opts.message || 'Unknown Error'; |
This file contains 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
// Restify Server CheatSheet. | |
// More about the API: http://mcavage.me/node-restify/#server-api | |
// Install restify with npm install restify | |
// 1.1. Creating a Server. | |
// http://mcavage.me/node-restify/#Creating-a-Server | |
var restify = require('restify'); |
This file contains 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 | |
# | |
# (1) copy to: ~/bin/ssh-host-color | |
# (2) set: alias ssh=~/bin/ssh-host-color | |
# | |
# Inspired from http://talkfast.org/2011/01/10/ssh-host-color | |
# Fork from https://gist.github.com/773849 | |
# | |
set_term_bgcolor(){ |