Skip to content

Instantly share code, notes, and snippets.

View jctosta's full-sized avatar

Carlos Tosta jctosta

  • Rio de Janeiro, Brazil
View GitHub Profile
@jctosta
jctosta / setProxyEnv.sh
Created November 8, 2015 12:40
Script para configuração automática de proxy em sistemas Linux
# Terminal Settings (WGET, Apt e etc.)
export http_proxy=http://localhost:3128
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy=localhost,127.0.0.1,localaddress,.localdomain.com,10.*
# Configurações para proxy automático em ambientes Gnome
if hash gsettings 2>/dev/null; then
gsettings set org.gnome.system.proxy autoconfig-url '<pac_file_location>'
@jctosta
jctosta / docker_cheatsheet.md
Last active February 2, 2023 12:26
Docker - Comandos Úteis

Docker - Comandos Úteis

Containers

  • Abrir um shell em um container em execução:
    • docker exec -t -i <container_id> <shell>

Limpeza

  • Excluir containers com status equivalente a Exited:

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@jctosta
jctosta / check_location.js
Created August 6, 2014 17:31
Check Machine Location
#!/usr/bin/env node
var args = process.argv.slice(2);
//console.log('Started');
// String startsWith polyfill
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
enumerable: false,
@jctosta
jctosta / cors-wso2.md
Created June 27, 2014 23:21
Configuração CORS Filter WSO2

Configuração de Cross Origin no WSO2

Para configurar o filtro Cross Origin no WSO2 é necessário editar o arquivo <APIM_HOME>/repository/deployment/server/webapps/oauth2/WEB-INF/web.xml, adicionando a seguinte informação no final do arquivo:

<filter>
	<filter-name>CORS</filter-name>
	<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
</filter>
@jctosta
jctosta / linux_cheatsheet.md
Last active October 21, 2021 20:50
Linux - Comandos úteis

Linux - Comandos Úteis

  • O comando abaixo força o git a sempre utilizar o protocolo https em seus downloads:
    • git config --global url."https://".insteadOf git://
  • Configuração de Proxy no GIT:
    • git config --global http.proxy http://proxyuser:proxypass@prxrj.prevnet:8080
    • git config --global https.proxy http://proxyuser:proxypass@prxrj.prevnet:8080
  • Liberar autenticação do proxy em ambientes sem interface gráfica (Resolve o problema do erro 407 ao realizar requisições):
    • curl -v -U proxyuser:proxypass -x http://prxrj.prevnet:8080 --url http://www.google.com --proxy-ntlm
  • Matar todos os processos Zumbi:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Gerenciador de Coleções</title>
</head>
<body>
</body>
</html>
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@jctosta
jctosta / maven-resources-plugin-config.xml
Created August 5, 2011 21:55
Configure maven plugin
<project>
...
<build>
<!-- To define the plugin version in your parent POM -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
@jctosta
jctosta / arquivo_with_exception_handling.rb
Created March 23, 2011 02:31
Leitura de arquivos com tratamento de exceção em ruby
begin
file = File.new("arquivo.rb", "r")
while (line = file.gets)
puts line
end
file.close
rescue => err
puts "Exception: #{err}"
err
end