Skip to content

Instantly share code, notes, and snippets.

@shadedyin
shadedyin / instructions.md
Created July 2, 2017 19:06 — forked from tpai/instructions.md
use both Tor and Privoxy with Mac OSX

1. install

brew install tor
brew install privoxy

2. copy and modify config file

func jsonResponse(w http.ResponseWriter, code int, err interface{}) int {
<<<<<<< HEAD
http.Error(w, fmt.Sprintf("{\"error\" : %s }", strconv.Quote(fmt.Sprintf("%s", err))), code)
=======
w.Header().Set("Content-Type", contentTypeJSON)
w.Write([]byte(`{"error": `))
json.NewEncoder(w).Encode(fmt.Sprint(err))
w.Write([]byte(`}`))
>>>>>>> e65d1557262c9b485336c3df7f35c049839ac497
return code
stream
|from()
.measurement('cpu')
// create a new field called 'used' which inverts the idle cpu.
|eval(lambda: 100.0 - "usage_idle")
.as('used')
|groupBy('service', 'datacenter')
|window()
.period(1m)
.every(1m)
[Unit]
Description=Sakai
After=network.target
[Service]
Type=forking
EnvironmentFile=/var/sakai/%i/environment
Environment=CATALINA_RUN=/var/run/%i
Environment=CATALINA_TEMP=/var/tmp/%i
Environment=CATALINA_BASE=/var/sakai/%i
[Unit]
Description=Tomcat 8 servlet container
After=network.target
[Service]
Type=forking
PIDFile=/var/run/tomcat8.pid
Environment=CATALINA_PID=/var/run/tomcat8.pid
Environment=TOMCAT_JAVA_HOME=/usr/lib/jvm/default-runtime
Environment=CATALINA_HOME=/usr/share/tomcat8
- name: wait for node to become active
wait_for: host=0.0.0.0 port=9160
provisioner "remote-exec" {
inline = [
"echo \"HOSTNAME=${var.cluster}-${count.index}\" >> /etc/environment",
"echo \"ECS_CLUSTER=${var.cluster}\" >> /etc/environment",
"echo \"ECS_REGISTRY=${var.registry}\" >> /etc/environment",
"echo \"ECS_AUTH=${var.auth}\" >> /etc/environment",
"echo \"ECS_EMAIL=${var.email}\" >> /etc/environment",
"echo \"NEWRELIC_TOKEN=${var.newrelic}\" >> /etc/environment",
"echo \"LOGENTRIES_TOKEN=${var.logentries}\" >> /etc/environment",
"echo \"TAGS=base,ecs\" >> /etc/environment"
resource "aws_instance" "registry" {
ami = "${var.ami}"
key_name = "psev"
instance_type = "t2.small"
subnet_id = "${element(aws_subnet.registry.*.id, 1)}"
vpc_security_group_ids = [ "${aws_security_group.registry.id}" ]
associate_public_ip_address = true
provisioner "remote-exec" {
inline = [
variable "subnets" {
default = {
us-east-1 = {
"0" = "b"
"1" = "c"
"2" = "d"
}
us-west-2 = {
"0" = "a"
"1" = "b"
variable "region" {
default = "us-east-1"
}
variable "subnets" {
default {
"0" = "b"
"1" = "c"
"2" = "d"
}