Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# stop any running old instances
cd ../latest
./stop.sh
cd $OLDPWD
# calculate state
CURRENT_TIMESTAMP=$(date "+%Y%m%d-%H%M%S")
if [ $# -eq 0 ]; then
git log --graph --abbrev-commit --decorate --oneline $(git merge-base origin/master HEAD)~1..
@bartfastiel
bartfastiel / one-shard.sh
Last active February 15, 2017 09:40
elasticsearch: idf in shards
echo delete index
curl -XDELETE 'http://127.0.0.1:9200/shardtermfrequency?pretty=1'
echo create index
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency?pretty=1' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1
}
}
}'
echo delete index
curl -XDELETE 'http://127.0.0.1:9200/shardtermfrequency?pretty=1'
echo create index
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency?pretty=1'
echo create type
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/_mapping/file?pretty=1'
echo insert files
curl -XPUT 'http://127.0.0.1:9200/shardtermfrequency/file/1?routing=0&pretty=1' -d'{
"fileName":"Elastic Match"
}'
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/enable_support" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/create?name=myorg&key=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/create?name=myprofile&language=java&organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/search" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/search?organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/search?defaults=true" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=myproject&name=myproject" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/search?project=myproject" | python -m json.tool
#delete
echo delete index
curl -XDELETE 'http://127.0.0.1:9200/histos?pretty=1'
echo create index
curl -XPUT 'http://127.0.0.1:9200/histos?pretty=1'
echo create type
curl -XPUT 'http://127.0.0.1:9200/histos/_mapping/histo?pretty=1' -d'{
"properties": {
"issueCreatedAt": {
"type": "date",
"format": "epoch_second"
@bartfastiel
bartfastiel / Vagrantfile
Last active February 16, 2020 19:23
vagrant SonarQube
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
!!!ONLY DO THIS IF YOU ACCEPT THE ORACLE LICENSE!!!
echo Downloading JVM...
wget --no-verbose -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-x64.tar.gz
echo "68ec82d47fd9c2b8eb84225b6db398a72008285fafc98631b1ff8d2229680257 jdk-8u162-linux-x64.tar.gz" > jdk-8u162-linux-x64.tar.gz.sha256
sha256sum -c jdk-8u162-linux-x64.tar.gz.sha256
tar -xzf jdk-8u162-linux-x64.tar.gz
@bartfastiel
bartfastiel / raspberry-pi-to-iot-controller.sh
Last active October 9, 2024 20:29
Setup pi for IoT controller
#!/bin/bash
####################################################
# curl -sSL https://bit.ly/bartfastiel-ylive | bash
####################################################
set -e
sudo apt-get update && sudo apt-get upgrade -y --no-install-recommends
echo "Enabling I2C, SPI, and PWM..."