Skip to content

Instantly share code, notes, and snippets.

View optyler's full-sized avatar
🏠
Working from home

Patrick Ferreira optyler

🏠
Working from home
View GitHub Profile
#!/bin/sh
#
# Post-receive hook script which generates README.html to git-dir from
# README.md found at the head of master branch in repository.
#
# Gitweb can read the README.html and embed it to the project summary page.
GIT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
git cat-file blob HEAD:README.md | markdown > $GIT_DIR/../README.html
@optyler
optyler / TestHal.java
Created April 20, 2015 09:10
HAL Rest api (Solr 4.8) over SolrJ-5.0.0.jar
package com.qwam;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.impl.XMLResponseParser;
import org.apache.solr.client.solrj.response.FacetField;
import org.apache.solr.client.solrj.response.QueryResponse;
/**
@optyler
optyler / install_openbox_fedora21.sh
Created July 23, 2015 09:12
Build and Install Openbox 3.6.1 from GIT sources on Fedora 21
# Clone git last sources
git clone git://git.openbox.org/mikachu/openbox openbox
cd openbox
# install dependencies (openbox 3.6.1) and build tools
sudo yum install gcc autoconf automake glib2-devel.i686 pango-devel.i686 imlib2-devel.i686 startup-notification-devel libXcursor-devel.i686 libXfixes-devel.i686 libSM-devel.i686 libxml2-devel.i686 gettext-devel libtoo
# start the configuration and environment tools
./bootstrap
# check for dependencies error before next
@optyler
optyler / fastest - Syracuse suite
Last active February 16, 2016 17:14
Codingame - Clashes
var n = readline(); // start number
var t = [n]; // final array with all the values, the first one is the start number
while(n !== 1) {
// if n is even, divide it by 2, else, if it is odd, multiply by 3 and add 1
n = (n%2 === 0) ? (n/2) : 3*n+1;
t.push( n );
}
print(t.join(' '))
var N = +readline();
var ROOT = {}; // All tree node with all numbers
var max = 0; // number of new keys in trees
for (let i = 0, CR; i < N; i++) {
CR = ROOT; // Current sub root elements with fragments of numbers, we always starts
var s = readline().split('');
for(let j=0, len=s.length; j < len; j++) {
@optyler
optyler / .Xdefaults
Created April 8, 2016 09:36
Linux configurations (fedora 21)
! Defaults for all xterm clients
Xcursor.size: 28
Xcursor.theme: Shere_Khan_X
! XTERM
XTerm*background: #191919
XTerm*foreground: #FED053
XTerm*highlightColor: magenta
XTerm*geometry: 71x21
XTerm*font: xft:Terminus:pixelsize=10:antialias=false
@optyler
optyler / generate_stats
Last active April 20, 2016 10:28
Generate csv files bases on result of sql files and send it by email
#!/usr/bin/bash
# directories
_time_stamp=$(date +%Y-%m-%d-%T)
_dir="${1:-${PWD}}"
_output_folder="$_dir/$_time_stamp"
# mysql
_mysql_user=user
_mysql_pass=user_pwd
# send mail
@optyler
optyler / .screenrc
Last active March 1, 2017 09:00
Custom configuration for linux screen tool
# Turn off that annoying start up message
startup_message off
# Turn the even more annoying whole-screen-flash-on-tab-complete "feature"
vbell off
# Window list at the bottom. hostname, centered tabs and redmarked active windows:
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
@optyler
optyler / .bash_profile
Last active March 1, 2017 09:03
osx .bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Git tweeks
git_dir_shell=$(brew --prefix)/etc/bash_completion.d
if [ -f $git_dir_shell/git-prompt.sh -a -f $git_dir_shell/git-completion.bash -a -f $git_dir_shell/git-flow-completion.bash ]; then
source $git_dir_shell/git-prompt.sh
source $git_dir_shell/git-completion.bash
source $git_dir_shell/git-flow-completion.bash
@optyler
optyler / .powerlevel9k
Created March 1, 2017 09:11
OhMyZsh + powerlevel9k
# iTerm font is SourceCode for powerlevel, size 11
# https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched
#
# iTerm Color theme is Seti
# https://github.com/willmanduffy/seti-iterm
#
POWERLEVEL9K_MODE='awesome-patched'
POWERLEVEL9K_NODE_VERSION_BACKGROUND='28'
POWERLEVEL9K_NODE_VERSION_FOREGROUND='15'
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'