Skip to content

Instantly share code, notes, and snippets.

@jtadeulopes
jtadeulopes / es-semaphore.sh
Last active November 24, 2019 06:54
A script for installing ES on SemaphoreCI
#! /usr/bin/env bash
## Usage:
## wget https://gist.githubusercontent.com/jtadeulopes/ae1f1ffe53000012b27b1112aecaa4b7/raw/45f792729d8b26e42f07028d0693e4de51024383/es-semaphore.sh && bash es-semaphore.sh <es-version>
##
ES_HOST="0.0.0.0"
ES_PORT="9200"
ES_VERSION=${1:-'5.0.0'}
DEB='elasticsearch-'"$ES_VERSION"'.deb'
@jtadeulopes
jtadeulopes / semaphore-es.sh
Last active October 4, 2017 23:17 — forked from BlackFoks/semaphore-es.sh
A script for installing ES on SemaphoreCI
#!/bin/bash
# Install a custom ElasticSearch version - https://www.elastic.co/products/elasticsearch
#
# To run this script on SemaphoreCI, add the following command to your project's build setup:
# \curl -sSL <RAW_URL_FOR_THIS_SCRIPT> | bash -s
#
ELASTICSEARCH_VERSION="2.4.6"
ELASTICSEARCH_PORT="9250"
ELASTICSEARCH_DIR="$SEMAPHORE_PROJECT_DIR/elasticsearch"
ELASTICSEARCH_WAIT_TIME="15"
@jtadeulopes
jtadeulopes / remove_css_extension.sh
Created September 11, 2015 16:55
Remove CSS extension
#!/bin/sh
# chmod a+x remove_css_extension.sh
for file in $(find ./app/assets/stylesheets/ -name "*.css.sass")
do
git mv $file `echo $file | sed s/\.css//`
done
@jtadeulopes
jtadeulopes / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jtadeulopes
jtadeulopes / slack.rb
Created August 14, 2014 01:18
Slack Bot
require 'httparty'
class SlackRuby
include HTTParty
base_uri 'slack.com/api'
def initialize(token)
@token = token
end
@jtadeulopes
jtadeulopes / download_map.rb
Created July 24, 2014 18:09
Download staticmap
require 'open-uri'
url = 'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&markers=color:0x4E3253%7C40.714728,-73.998672&zoom=15&size=640x640&scale=2&format=png&maptype=roadmap&sensor=false'
target = File.join(File.expand_path('../', __FILE__), '/maps.jpg')
File.open(target, "wb") do |saved_file|
open(url, 'rb') do |read_file|
saved_file.write(read_file.read)
end
end
@jtadeulopes
jtadeulopes / conditional_spec.rb
Created July 11, 2014 13:21
Conditional hooks
describe Classroom do
subject(:classroom) { Classroom.new }
context "when the children are rowdy" do
before(:each, run: true) do
classroom.throw_pizza_party
end
it "example1", run: :true
it "example2"
@jtadeulopes
jtadeulopes / block.sh
Created February 24, 2014 16:18
Iptables rules
# sudo sh block.sh
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "ads.yahoo.com" --algo kmp -j DROP
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "ads.fcmrktplace.com" --algo kmp -j DROP
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "ads.creafi-online-media.com" --algo kmp -j DROP
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "ib.reachjunction.com" --algo kmp -j DROP
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "www.indeed.com" --algo kmp -j DROP
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "ib.adnxs.com" --algo kmp -j DROP
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "ad.tagjunction.com" --algo kmp -j DROP
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "ad.globe7.com" --algo kmp -j DROP
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "ads.clicksor.com" --algo kmp -j DROP
@jtadeulopes
jtadeulopes / localhost_https.conf
Last active May 30, 2021 14:26
Nginx config with https support
upstream project {
server unix:///var/tmp/project.sock;
}
server {
listen 80 default_server;
server_name project.com;
return 301 https://$server_name$request_uri;
}
@jtadeulopes
jtadeulopes / filetype.vim
Last active September 10, 2015 19:14
filetype.vim
au BufRead,BufNewFile /opt/nginx/conf/* set ft=nginx