Skip to content

Instantly share code, notes, and snippets.

View IgorDePaula's full-sized avatar
😆

Igor C. de Paula IgorDePaula

😆
View GitHub Profile
@IgorDePaula
IgorDePaula / server-git.conf
Created May 27, 2019 20:21 — forked from massar/server-git.conf
Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# jeroen@massar.ch - http://jeroen.massar.ch
server {
listen 192.0.1.1:80;
listen [2001:db8::1]:80;
# Redirect all non-HTTPS traffic to the HTTPS variant
return 301 https://$host$request_uri;
}
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@IgorDePaula
IgorDePaula / post-receive
Created May 18, 2019 22:52 — forked from sergeyhush/post-receive
Post-receive git hook to check if file changed
#!/bin/bash
WATCH_FILE="abc.123"
while read oldrev newrev refname; do
if [ "$refname" = "refs/heads/master" ]; then
if git diff-tree --name-only -r -z $oldrev $newrev | grep --quiet $WATCH_FILE ; then
# WATCH_FILE changed...
fi
fi
done
@IgorDePaula
IgorDePaula / s3-playbook.yml
Created May 17, 2019 00:07 — forked from ebridges/s3-playbook.yml
Ansible playbook to generate one or more S3 buckets with permissions useful for rclone.
---
## Usage:
## ansible-playbook s3-playbook.yml
- hosts: localhost
connection: local
gather_facts: False
vars:
buckets:
'<BucketName>' : '<BucketARN>'
'com.example.bucket' : 'arn:aws:s3:::com.example.bucket'
<?php
namespace Telegram;
use GuzzleHttp\Client;
class Api
{
private $token;
private $client;
@IgorDePaula
IgorDePaula / ffmpeg-compress-mp4
Created October 29, 2018 02:56 — forked from lukehedger/ffmpeg-compress-mp4
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@IgorDePaula
IgorDePaula / atualiza-repo-README.md
Last active October 23, 2018 19:14 — forked from erikfig/README.md
Atualizar repositório forked com o original, simples e rápido

Crie dois alias, um para adicionar o repositório e outro para atualizar:

git config --global alias.arf "!git remote add upstream"
git config --global alias.uf "!git fetch upstream && git checkout master && git merge upstream/master"

Isso cria dois comandos git, o primeiro para adicionar remoto forked (arf) e segundo para atualizar o forked (uf - u de update).

Da primeira vez que for usar você adiciona o original:

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Publicacao;
use App\User;
use App\Categoria;
use Illuminate\Support\Facades\DB;
use Storage;
#!/usr/bin/expect
set password [lindex $argv 0]
spawn git push deploy master
expect eof
send $password\n
expect eof