Skip to content

Instantly share code, notes, and snippets.

View jesuscast's full-sized avatar

Andres Castaneda jesuscast

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jesuscast on github.
  • I am andresjcast (https://keybase.io/andresjcast) on keybase.
  • I have a public key ASDRJUnO6kvC-nk0r1VK7e_H0jq9ggSsXK8MCZIu3klIngo

To claim this, I am signing this object:

Implement a REST server with the following endpoints.

POST /user/register

Body

{
  "username": "XXXXXXX”
}
def binarySearch(alist, item):
first = 0
last = len(alist)-1
index = None
while first<=last and not index:
midpoint = (first + last)//2
if alist[midpoint] >= item:
index = midpoint
else:
if item < alist[midpoint]:
def binarySearch(alist, item):
first = 0
last = len(alist)-1
index = None
while first<=last and not index:
midpoint = (first + last)//2
if alist[midpoint] >= item:
index = midpoint
else:
if item < alist[midpoint]:
java -jar selenium-server-standalone.jar -role node -hub http://localhost:4444/grid/register -browser browserName=chrome,version=52.0,chrome_binary='/usr/bin/google-chrome',platform=LINUX,maxInstances=5
var chromeCapabilities, chromeOptions, driver;
chromeCapabilities = selenium.Capabilities.chrome();
chromeOptions = {
'args': ['--load-extension=yourExtensionFolder']
};
chromeCapabilities.set('chromeOptions', chromeOptions);
driver = new selenium.Builder().usingServer('http://x.x.x.x:4444/wd/hub').withCapabilities(chromeCapabilities).build();
driver.getWindowHandle();
function sendTextMessage(sender, text) {
let messageData = { text:text }
request({
url: 'https://graph.facebook.com/v2.6/me/messages',
qs: {access_token:token},
method: 'POST',
json: {
recipient: {id:sender},
message: messageData,
@jesuscast
jesuscast / maxer.sh
Created March 18, 2016 06:11
Finds the id of the process that has the most open files.
HIGHEST_PROCESS=''
HIGHEST_PROCESS_FILES=0
ps aux | awk 'NR > 1' | awk '{ print $2 }' > tmp.txt
while read -r process_element; do
process_pid="$process_element"
number_of_files=`lsof -p $process_pid | wc -l | awk '{ print $1 }'`
if [ $number_of_files -gt $HIGHEST_PROCESS_FILES ]; then
HIGHEST_PROCESS=$process_pid
HIGHEST_PROCESS_FILES=$number_of_files
fi
@jesuscast
jesuscast / david.py
Last active February 16, 2016 18:57
# First initialize the array with all positions 0
array_2d = None
calculated_values = None
# save the total number of rows and the total number of columns in global variables
rows_n = 0
columns_n = 0
testing = False
# Now make the function to obtain the values at y_row, and x_column
@jesuscast
jesuscast / lol.js
Created December 3, 2015 23:28
hides deleted ads from your craigslist account.
$(".status").each(function(index, element) { if($(element).html().indexOf("Deleted") != -1 ) { $(element).parent().hide(); }; });