Skip to content

Instantly share code, notes, and snippets.

View dalegaspi's full-sized avatar
🎓
BU S2 2022

Dexter Legaspi dalegaspi

🎓
BU S2 2022
View GitHub Profile
@dalegaspi
dalegaspi / Readme.txt
Created May 19, 2015 20:48
Jersey 2.x Using Embedded Jetty with Swagger, CORS, and a ServletContextListener
the .java file is for initializing using embedded Jetty...the web.xml is for deploying the Jersey service as a WAR file.
@dalegaspi
dalegaspi / install_ejdb_osx.sh
Created April 18, 2015 15:35
Installing SoftMotion's EJDB (Embedded JSON DB) on OS X Yosemite
# use withe sudo when applicable
# install cmake via MacPorts
port install cmake
# install as per INSTALL
git clone https://github.com/Softmotions/ejdb.git
cd ejdb
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../
@dalegaspi
dalegaspi / del_solr_write_lock.sh
Created January 5, 2015 19:59
delete write.lock files in Solr to prevent "unavailable" status due to write.lock acquire timeouts
sudo find . -type f -name "write.lock" -exec rm -f {} \;
@dalegaspi
dalegaspi / ftp.ps1
Last active January 7, 2022 03:11
FTP with PowerShell using built-in Windows FTP client
# as discussed here: http://stackoverflow.com/questions/1867385/upload-files-with-ftp-using-powershell
$server = "ftp.lolcats.com"
$filelist = "file1.txt file2.txt"
"open $server
user $user $password
binary
cd $dir
" +
@dalegaspi
dalegaspi / aero_insert.java
Created December 10, 2014 15:02
Code fragment fo inserting into Aerospike db
ClientPolicy cp = new ClientPolicy();
cp.maxThreads = 5000;
Stopwatch stopwatch = Stopwatch.createStarted();
final AerospikeClient client = new AerospikeClient(cp, "localhost", 3000);
stopwatch.stop();
System.out.println("aerospike connect elapsed = " + stopwatch.elapsed(TimeUnit.MILLISECONDS));
@dalegaspi
dalegaspi / python27_on_centos65.md
Last active September 9, 2021 05:29
Installing Python 2.7 on CentOS 6.5

Installing Python 2.7 on Centos 6.5

Centos 6.* comes with Python 2.6, but we can't just replace it with v2.7 because it's used by the OS internally (apparently) so you will need to install v2.7 (or 3.x, for that matter) along with it. Fortunately, CentOS made this quite painless with their Software Collections Repository

sudo yum update # update yum
sudo yum install centos-release-scl # install SCL 
sudo yum install python27 # install Python 2.7

To use it, you essentially spawn another shell (or script) while enabling the newer version of Python:

@dalegaspi
dalegaspi / bootstrap_typeahead_html_fragment.html
Last active August 29, 2015 14:06
Gist for Solr with Twitter Typeahead
<form role="search">
<div class="form-group">
<div class="input-group col-sm-6">
<input id="querytxt" type="text" class="typeahead form-control" />
<span class="input-group-btn">
<button id="solrsearch" class="btn btn-primary" type="button"><span class="glyphicon glyphicon-search" />
</span>
</div>
</div>
</form>
@dalegaspi
dalegaspi / jsVewsSample.html
Last active August 29, 2015 14:06
jsView sample with Tables and asynchronous JSON
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>K2 Scheduler/Ingester Status</title>
<!-- Latest compiled and minified CSS -->
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Threading.Tasks;
namespace RemoveXmlNamespaceApp
{
class Program
@dalegaspi
dalegaspi / DocLoader.cs
Created May 31, 2014 18:32
A simple loader from SQL Server to Cassandra using DataStax C# Drivers
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cassandra.Data.Linq;
using Cassandra.Data;
using Cassandra;
using System.Data;
using System.Data.SqlClient;