Skip to content

Instantly share code, notes, and snippets.

View franciscocpg's full-sized avatar

Francisco Guimarães (chico) franciscocpg

View GitHub Profile
@franciscocpg
franciscocpg / CURL POST.md
Last active October 15, 2015 19:01
Example how to call post with payload

This examples work with json-server

curl -X POST  -H "Content-Type: application/json" -d '[{"name":"user20","id":20}]' http://localhost:3000/users

Executar

sudo apt-get install xfswitch-plugin

echo '#!/bin/sh
#
# replacement for missing gdmflexiserver in Ubuntu 14.04
#
dm-tool switch-to-greeter' |  sudo tee /usr/local/bin/gdmflexiserver > /dev/null

Given an api that returns gzip content (Content-Encoding: gzip at responde header), the code below is goint to gunzip the content.

curl -v -H 'Accept-Encoding: gzip, deflate, sdch' http://url | gunzip -

TZ="America/Sao_Paulo"
# Change time zone (Using Sao_Paulo as example)
sudo mv /etc/localtime /etc/localtime.bak
sudo ln -s /usr/share/zoneinfo/$TZ /etc/localtime
sudo sh -c "echo -e 'ZONE=\"$TZ\"\n' > /etc/sysconfig/clock"
# Sync with ntp
sudo yum install ntp -y
sudo chkconfig ntpd on
# JAVA
VERSION=8
UPDATE=60
BUILD=27
JAVA_HOME=/usr/lib/jvm/java-${VERSION}-oracle
sudo apt-get update && sudo apt-get install ca-certificates curl -y
sudo curl --location --retry 3 --cacert /etc/ssl/certs/GeoTrust_Global_CA.pem \
--header "Cookie: oraclelicense=accept-securebackup-cookie;" \
http://download.oracle.com/otn-pub/java/jdk/"${VERSION}"u"${UPDATE}"-b"${BUILD}"/jdk-"${VERSION}"u"${UPDATE}"-linux-x64.tar.gz \

curl -s -X GET -o /dev/null -I -w "%{http_code}" http://www.google.com.br

Take a look at http://curl.haxx.se/docs/manpage.html, at the parameter -w, --write-out for a list of available variables to use.

#!/bin/bash
# Timezone America/Sao_Paulo
sudo timedatectl set-timezone America/Sao_Paulo
# Sincronize with ntp
sudo apt-get update
sudo apt-get install ntp

Master (Ubuntu 14.04)

wget -O - https://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest trusty main" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install salt-master salt-minion salt-ssh

Master (CentOS 7 server)

cd /tmp
# Install rocksdb from mongorocks branch
git clone https://github.com/facebook/rocksdb.git
cd rocksdb
git checkout mongorocks
make static_lib
sudo make install
cd ..
# install dependencies
sudo apt-get install libbz2-dev libsnappy-dev zlib1g-dev libzlcore-dev scons
# compile-install-mongo-rocksdb.sh
bash <(curl -s https://gist.githubusercontent.com/franciscocpg/83b91a2c9c929a05eb8f/raw/)