Skip to content

Instantly share code, notes, and snippets.

View ninjayoto's full-sized avatar

ninjayoto

  • Canada
View GitHub Profile
@Test
public void postMessage()
{
driver.get("https://csc510-fall16.slack.com/");
// Wait until page loads and we can see a sign in button.
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("signin_btn")));
// Find email and password fields.
@ninjayoto
ninjayoto / es-attach-full.py
Created December 7, 2018 06:39 — forked from stevehanson/es-attach-full.py
Interactive Python script to recursively index files in directory tree to elasticSearch using the elasticsearch-mapper-attachments (https://github.com/elasticsearch/elasticsearch-mapper-attachments) plugin to index files (pdf, docx, html, etc).
import os
import sys
# constants, configure to match your environment
HOST = 'http://localhost:9200'
INDEX = 'test'
TYPE = 'attachment'
TMP_FILE_NAME = 'tmp.json'
# for supported formats, see apache tika - http://tika.apache.org/1.4/formats.html
INDEX_FILE_TYPES = ['html','pdf', 'doc', 'docx', 'xls', 'xlsx', 'xml']
@ninjayoto
ninjayoto / EchoTest.java
Created February 7, 2019 17:50 — forked from chbaranowski/EchoTest.java
Cheat Sheet Test for Mockito
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Mockito.*;
import static org.mockito.BDDMockito.*;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
@ninjayoto
ninjayoto / aws-couchdb-setup.md
Created March 25, 2019 02:59 — forked from Ravenstine/aws-couchdb-setup.md
Fast CouchDB setup in AWS

Fast CouchDB setup in AWS

CouchDB is a NoSQL database for storing JSON documents. It comes with a REST API out of the box so your client applications can persist data while requiring you to write little or no server-side code. CouchDB's killer feature is its ability to easily replicate, which allows for horizontal scaling, easy backup, and for client adapters to synchronize documents. This is perfect if you want to write an application that is offline-first. It's become my go-to database when creating new

@ninjayoto
ninjayoto / avregex.md
Created April 8, 2019 03:09 — forked from eightyknots/avregex.md
AvReg: Aviation regex match toolkit

AvReg: The Aviation RegEx Match Toolkit

General Tips

  • The PCRE flavour of RegEx is used here.
  • Append the i modifier to the end of the regex to make any pattern case-insensitive.

Airline Codes

| Purpose | Description | RegEx | Example |

@ninjayoto
ninjayoto / twitter4j-find-replies.java
Created September 20, 2019 16:28 — forked from ivamluz/twitter4j-find-replies.java
Code snippet showing how to post a reply to a tweet using twitter4j library
public static List<Status> findReplies() {
Query query = new Query("iluzcit");
List<Status> tweets = new ArrayList<Status>();
Twitter twitter = new TwitterFactory().getInstance();
try {
QueryResult result;
do {
result = twitter.search(query);
@ninjayoto
ninjayoto / QuickSort.java
Created September 7, 2020 16:57 — forked from jayeshsolanki93/QuickSort.java
QuickSort in Java
import java.util.Arrays;
import java.util.Scanner;
class QuickSort {
private static Scanner sc;
public static void main(String args[]) {
sc = new Scanner(System.in);
System.out.println("Enter no of terms");
@ninjayoto
ninjayoto / eBay average price
Created May 1, 2021 23:55 — forked from danomoseley/eBay average price
Find an average sold price of an eBay search.Do a search for a product, check the "Sold listings" option under "Show only" in the left navigation.Run this script by pasting it into the console tab of the chrome developer tools.
function Stats(arr) {
var self = this;
var theArray = arr || [];
//http://en.wikipedia.org/wiki/Mean#Arithmetic_mean_.28AM.29
self.getArithmeticMean = function() {
var sum = 0, length = theArray.length;
for(var i=0;i<length;i++) {
sum += theArray[i];
}
@ninjayoto
ninjayoto / jq-cheetsheet.md
Created February 14, 2022 22:30 — forked from gillchristian/jq-cheetsheet.md
jq Chaet Sheet [cheat-sheet]

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@ninjayoto
ninjayoto / add_item.php
Created June 14, 2022 00:13 — forked from davidtsadler/add_item.php
Example showing how to list an item to the eBay Sandbox using the eBay Accelerator Toolkit New Schema (EbatNS) for PHP.
<?php
/*
* Author: David T. Sadler (http://davidtsadler.com)
* Date: 2013-03-29
* License: I release this example into the public domain. Use at your own risk.
*
* Example showing how to list an item to the eBay Sandbox using the eBay Accelerator Toolkit New Schema (EbatNS) for PHP.
*
* This example uses version 815 released on the 2013-03-22.
* http://www.intradesys.de/en/system/files/its_downloads/EbatNs_1_0_815_P5_0.zip