Skip to content

Instantly share code, notes, and snippets.

View gelias's full-sized avatar

Guilherme Elias gelias

View GitHub Profile
cat /var/log/nginx/access.log | awk '{print $8}' | awk -F '/' '{print $4}' | awk -F 'e' '{print $1}' | sort | uniq -c | sort -n
cat /var/log/nginx/access.log | awk '{print $8}' | awk -F '/' '{print $4}' | awk -F 'e' '{print $1}' | sort | uniq -c | sort -n
#Amazon Linux
vi /etc/sysconfig/network
hostname vm-hostname
#1 OK
Input: 5,5
Commands: L,L,N,N,L,L
Output: 9,3
#2 MARGEM ESQ
Input: 1,1
Commands: O,O,S,S
Output: Coordenada (1) Invalida
@gelias
gelias / gist:5025e2dc73f37c856c59a57826ae7915
Last active March 15, 2018 19:05
Migrate SVN projects to Git
#Using Case-sentive or Non Case-sensitive filesystem
# Bitbucket tutorial https://www.atlassian.com/git/tutorials/migrating-prepare
java -jar ~/svn-migration-scripts.jar authors http://SVN_URL:SVN_PORT/svn/<PATH>/trunk/<repo-name> <svn_user> <svn_password> > /tmp/authors.txt
git svn clone --trunk=./ --authors-file=/tmp/authors.txt http://SVN_URL:SVN_PORT/svn/<PATH>/trunk/<repo-name> /tmp/<git_repo_name>
#Using Docker - https://hub.docker.com/r/yukinagae/svn-to-git
docker pull yukinagae/svn-to-git
@gelias
gelias / mix.rb
Created September 15, 2017 16:28
file=File.new('/tmp/Mix.csv')
while (line = file.gets)
parts = line.split("\;")
puts("DELETE FROM cadastrocustomizavelvalor WHERE cdv_identificadoralternativo = '#{parts[0]}_mix_#{parts[1]}' and cdv_cli_codigo = 14100 and cad_codigo = 96411;")
end
file.close
server {
listen 80;
server_name alias.dominio.com 127.0.0.1;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@gelias
gelias / search_delete_elasticsearch_index.js
Last active June 22, 2017 02:13
Search and Delete Elastic Search indices
$('pre').textContent.split(" ").forEach(function(element){ if(element.startsWith('api')){console.log("curl -XDELETE 'URL_TO_API_SEARCH/"+element+" && echo")} });
// https://ip-ranges.amazonaws.com/ip-ranges.json
JSON.parse($('pre').textContent).prefixes.forEach(function(entry){ console.log(entry.ip_prefix);})
system("sed -i '1iNEW_TEXT' EXISTING_FILE.TXT")