Skip to content

Instantly share code, notes, and snippets.

View jorgejch's full-sized avatar

Jorge Haddad jorgejch

View GitHub Profile
@jorgejch
jorgejch / ALLPAIRS-params.js
Created January 17, 2021 20:54 — forked from vosechu/ALLPAIRS-params.js
Gunbot 3.3.2 config
//-----------------------------------------------
// Instructions for this file
//-----------------------------------------------
// This file will provide the basis for all the more specific files. All the
// options set in here will be used by `config.js` files unless they're
// overridden in that file.
//
// If you want to affect all coins at once, edit this file; you don't need to
// reboot the bots though, they'll see that the config changed.
//-----------------------------------------------
@jorgejch
jorgejch / 71-synaptics_mod.conf
Last active April 21, 2017 04:36 — forked from csarven/touchpadconf.sh
Update @aloiscochard's xorg conf with @csarven's touchpadconf.sh mods
Section "InputClass"
Identifier "touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
#1 finger = left click, 2 finger = right click, 3 finger = middle click
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "ClickFinger2" "3"
Option "ClickFinger3" "2"
@jorgejch
jorgejch / SEARCHABLE.java
Last active December 22, 2016 05:19
Enum for reverse lookup.
public enum SEARCHABLE {
DESCRIPTION("description"),
NAME("name"),
DISPLAYNAME("displayName"),
TAGS("tags");
final private static Set<String> _searchableFieldNames =
Arrays.stream(SEARCHABLE.values()).map(SEARCHABLE::getFieldName).collect(Collectors.toSet());
final private String _fieldName;
@jorgejch
jorgejch / bashrc_backligth_command.sh
Created November 26, 2015 00:27
A backlight control command for bashrc.
# Usage: $ bl <integer><- or +>
function bl {
INC_PARAM=10
DEC_PARAM=-${INC_PARAM}
case $1 in
+([0-9])- ) xbacklight -inc $(expr -1 + $DEC_PARAM \* ${1%-}); return 0;;
+([0-9])+ ) xbacklight -inc $(expr 1 + $INC_PARAM \* ${1%+}); return 0;;
* ) return 1;;
esac
}
@jorgejch
jorgejch / prob_1_ADA_course.py
Last active December 7, 2015 22:47
You are given as input an unsorted array of n distinct numbers, where n is a power of 2. Give an algorithm that identifies the second-largest number in the array, and that uses at most n+log2n−2 comparisons.
# https://class.coursera.org/algo-009/forum/thread?thread_id=29
def get_second_largest(nums_lst):
"""
>>> get_second_largest([3,1,10,17,12,4])
12
"""
def get_greaters_lst(lst):
if len(lst) == 1:
return lst
@jorgejch
jorgejch / NamedPipe.java
Last active May 24, 2018 17:08
Class implements named pipe access and creation.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.nio.channels.FileChannel;
// From: https://github.com/sioutisc/jdds/blob/master/JDDS/src/rtjdds/rtps/transport/NamedPipe.java
import base64
import cStringIO
import PIL.Image
'''
From:
http://stackoverflow.com/questions/31410525/base64-uri-to-png-python
http://stackoverflow.com/questions/3715493/encoding-an-image-file-with-base64
http://effbot.org/imagingbook/image.htm
'''