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
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 / 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(' '))
@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 / 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 / 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;
/**
#!/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 / sublime-text-3.sh
Last active July 13, 2022 17:48 — forked from sayak-sarkar/sublime-text-3.sh
Download and install sublime text 3 on fedora 21
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/opt/sublime_text_3/sublime_text
Icon=/opt/sublime_text_3/Icon/128x128/sublime-text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"