Skip to content

Instantly share code, notes, and snippets.

@jtadeulopes
jtadeulopes / es-semaphore.sh
Last active Nov 24, 2019
A script for installing ES on SemaphoreCI
View es-semaphore.sh
#! /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 Oct 4, 2017 — forked from BlackFoks/semaphore-es.sh
A script for installing ES on SemaphoreCI
View semaphore-es.sh
#!/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"
View remove_css_extension.sh
#!/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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View slack.rb
require 'httparty'
class SlackRuby
include HTTParty
base_uri 'slack.com/api'
def initialize(token)
@token = token
end
View download_map.rb
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
View conditional_spec.rb
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"
View block.sh
# 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
Nginx config with https support
View localhost_https.conf
upstream project {
server unix:///var/tmp/project.sock;
}
server {
listen 80 default_server;
server_name project.com;
return 301 https://$server_name$request_uri;
}
View filetype.vim
au BufRead,BufNewFile /opt/nginx/conf/* set ft=nginx