Skip to content

Instantly share code, notes, and snippets.

View luizkowalski's full-sized avatar
:shipit:
bug fixes and performance improvements

Luiz Eduardo Kowalski luizkowalski

:shipit:
bug fixes and performance improvements
View GitHub Profile
@luizkowalski
luizkowalski / change-codec.md
Created March 25, 2025 13:01 — forked from dvf/change-codec.md
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@luizkowalski
luizkowalski / rails_cloc.sh
Last active May 2, 2018 14:34 — forked from nlively/rails_cloc.sh
Count lines of code in a rails project
#!/bin/bash
find . \( -iname '*.rb' -o -iname '*.jb' -o -iname '*.erb' -o -iname '*.rake' \) -not -path "./spec/*" -not -path "./db/*" -exec wc -l {} + | sort -n
kubectl get pods --show-all=true | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@luizkowalski
luizkowalski / base_controller.rb
Created September 22, 2016 10:16 — forked from dhoelzgen/base_controller.rb
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
@luizkowalski
luizkowalski / gist:a7140af53bd64aa82a65
Created February 23, 2016 22:11 — forked from rakasaka/gist:1169341
Unsupervised topic modeling in Ruby using LDA
require 'lda-ruby'
corpus = Lda::Corpus.new
corpus.add_document(Lda::TextDocument.new(corpus, "a lion is a wild feline animal", []))
corpus.add_document(Lda::TextDocument.new(corpus, "a dog is a friendly animal", []))
corpus.add_document(Lda::TextDocument.new(corpus, "a cat is a feline animal", []))
lda = Lda::Lda.new(corpus)
lda.verbose = false
lda.num_topics = (2)
lda.em('random')
#!/bin/bash
oldbase="gruber"
newbase="gruberteste"
nomearquivo="$oldbase-$(date +%d%m%Y-%H%M%S).sql"
outputfile="/home/gts/sql-base-fiscal/$nomearquivo"
httpserver="/srv/http/"
echo "==========================================="
echo "Fazendo dump da base \"$oldbase\""

Filter to generate PDF from Servlet dynamic pages

This filter intercepts the response and runs Flying Saucer ITextRenderer on it, returning a pdf instead.

Configuration

Just put the filter on your code and configure the url patterns where it will run on web.xml. The filtered pages will return as pdf documents.

select:focus, textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="color"]:focus{
border-color: rgba(82, 168, 236, 0.8);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgb(7, 122, 175);
outline: 0 none;
}
@luizkowalski
luizkowalski / geoip_service.rb
Created September 4, 2012 18:10 — forked from mislav/geoip_service.rb
Simple GeoIP service class using freegeoip.net and Faraday
require 'faraday_middleware'
require 'hashie/mash'
# Public: GeoIP service using freegeoip.net
#
# See https://github.com/fiorix/freegeoip#readme
#
# Examples
#
# res = GeoipService.new.call '173.194.64.19'
@luizkowalski
luizkowalski / es.sh
Created August 9, 2012 12:51
Install ElasticSearch on Ubuntu 12.04
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.8.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share