Skip to content

Instantly share code, notes, and snippets.

View jnwelzel's full-sized avatar
💻
[object Object]

Jonathan Welzel jnwelzel

💻
[object Object]
View GitHub Profile
@jnwelzel
jnwelzel / perguntas_empresa.md
Last active January 2, 2016 15:08
Perguntas a serem feitas pelo funcionário na hora da contratação que lá na frente podem evitar dores de cabeça.
  1. Vou ter que abrir outra conta bancária só pra receber o salário de vocês?
  2. Empresa dispõe de estacionamento coberto? Pra mim, que tenho moto, isso é essencial.
  3. Se não quiserem te dar tempo pra pensar na proposta e ficarem tentando te forçar a dar logo uma resposta se vai aceitar o cargo ou não, tome cuidado porque essa empresa provavelmente é ejaculação precoce e vai botar pressão p caramba. Esteja ciente disso.
@jnwelzel
jnwelzel / vlc_red_hat.md
Last active January 2, 2016 12:19
How to install VLC Media Player on Red Hat

Installing VLC Media Player on Red Hat

My Red Hat version: 6.5 (Santiago)
My architecture: x86_64

  1. Head over to http://rpmfusion.org/Configuration, download the RPM and install it. This will end up enabling the RPM Fusion repo on your machine. Later you can disable it if you prefer by editing the corresponding *.repo file inside the /etc/yum.repos.d/ directory. This might avoid unecessary conflicts later on.
  2. Now to install VLC open up your terminal and use $ sudo yum install vlc.x86_64 (you might have to update yum repos first, not sure).

That's it!

@jnwelzel
jnwelzel / sql_notes.sql
Last active January 2, 2016 11:49
Since I suck at SQL, here are a few notes and reminders if ever my memory fails me (and it always does)
UPDATE table_name
SET column1=value1
WHERE some_column=some_value;
ALTER TABLE table_name
ADD column_name datatype;
/* SQL Server */
alter table DEFAULT_PROPRIED_DOCTO
add VERSION bigint not null default 1;
@jnwelzel
jnwelzel / search_form.scala.html
Created July 20, 2013 18:04
twitter bootstrap search form the way i like it
<div id="actions">
<form action="@link(0, "name")" method="GET" class="form-search">
<div class="input-append">
<input type="search" id="searchbox" name="f" value="@currentFilter" placeholder="Filter by device name..." class="input-medium search-query">
<button type="submit" id="device-search-submit" class="btn"><i class="icon-search"></i> Search</button>
</div>
</form>
</div>
# 1. not working
redirect_to contact_path(@message), :flash => { :error => "Captcha error! The image code you informed is incorrect."}
# 2. not working
flash[:error] = "Captcha error! The image code you informed is incorrect."
redirect_to contact_path(@message)
# 3. WORKING
flash[:error] = "Captcha error! The image code you informed is incorrect."
render "new"
@jnwelzel
jnwelzel / certificates.txt
Last active May 9, 2021 22:32
Client authentication through SSL certificate in JBoss AS 7.1.1.Final. This configuration will make sure that only clients whose certificates are trusted by the server may have access to the application (standalone.xml line 272)
PASSWORD
changethis
SERVER KEYSTORE - used by the server to establish a secure connection (HTTPS)
c:\eclipse\jdk1.7.0_05\jre\bin\keytool.exe -genkey -keyalg RSA -alias localhost -keystore localhost.jks -validity 365 -keysize 2048
CLIENT KEYSTORE - used to generate ".cer" file that wil be used in the server's trustore and in the browser to identify the client with the server
c:\eclipse\jdk1.7.0_05\jre\bin\keytool.exe -genkey -keyalg RSA -alias jonwelzel -keystore jonwelzel.jks -validity 365 -keysize 2048
@jnwelzel
jnwelzel / HttpProxyAuth.java
Created April 4, 2013 17:04
The boilerplate needed to make a http request behind a proxy that requires authentication
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 5000);
HttpConnectionParams.setSoTimeout(httpParams, 5000);
DefaultHttpClient client = new DefaultHttpClient(httpParams);
client.getCredentialsProvider().setCredentials(
new AuthScope(PROXY_HOSTNAME, PROXY_PORT),
new UsernamePasswordCredentials(PROXY_USERNAME, PROXY_USERPWD));
HttpHost proxy = new HttpHost(PROXY_HOSTNAME, PROXY_PORT);
client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
@import "jbar.colors";
@import "jbar";
@jnwelzel
jnwelzel / company_user_rel.rb
Created August 13, 2012 18:22
Company -> User (owner)
class Company
include Mongoid::Document
include Mongoid::Timestamps
has_and_belongs_to_many :users
belongs_to :owner, class_name: "User", inverse_of: :owns
end
class User
include Mongoid::Document
@jnwelzel
jnwelzel / cidades.json
Created August 1, 2012 14:44
JSON que eu usei para gerar os documents da collection de cidades no mongodb
[{"estado_id":11,"_id":1100015,"nome":"Alta Floresta D'Oeste"},{"estado_id":11,"_id":1100023,"nome":"Ariquemes"},{"estado_id":11,"_id":1100031,"nome":"Cabixi"},{"estado_id":11,"_id":1100049,"nome":"Cacoal"},{"estado_id":11,"_id":1100056,"nome":"Cerejeiras"},{"estado_id":11,"_id":1100064,"nome":"Colorado do Oeste"},{"estado_id":11,"_id":1100072,"nome":"Corumbiara"},{"estado_id":11,"_id":1100080,"nome":"Costa Marques"},{"estado_id":11,"_id":1100098,"nome":"Espig\u00e3o D'Oeste"},{"estado_id":11,"_id":1100106,"nome":"Guajar\u00e1-Mirim"},{"estado_id":11,"_id":1100114,"nome":"Jaru"},{"estado_id":11,"_id":1100122,"nome":"Ji-Paran\u00e1"},{"estado_id":11,"_id":1100130,"nome":"Machadinho D'Oeste"},{"estado_id":11,"_id":1100148,"nome":"Nova Brasil\u00e2ndia D'Oeste"},{"estado_id":11,"_id":1100155,"nome":"Ouro Preto do Oeste"},{"estado_id":11,"_id":1100189,"nome":"Pimenta Bueno"},{"estado_id":11,"_id":1100205,"nome":"Porto Velho"},{"estado_id":11,"_id":1100254,"nome":"Presidente M\u00e9dici"},{"estado_id":11,"_id":110