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 / Apigee Add Developer User Script.tamper.js
Last active August 29, 2015 13:57
TamperMonkey/GreaseMonkey script to extend apigee dashboard by adding a dropdown list of custom attribute names of your choice.
// ==UserScript==
// @name Apigee Add Developer User Script
// @namespace http://ap.org/
// @version 0.9
// @description This allows easier adding of custom properties
// @match https://enterprise.apigee.com/platform/*
// @copyright 2014+, dlegaspi@ap.org
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
@dalegaspi
dalegaspi / display-create-import-dps.sh
Last active August 29, 2015 14:01
I'm creating an elasticsearch import data file using python (import.txt) and I wanted to display the real-time documents per second
tail -f import.txt | grep --line-buffered _index | while read line; do printf "$(date '+%F %T')\n"; done | uniq -c
@dalegaspi
dalegaspi / DocumentModule.cs
Created May 31, 2014 18:28
A simple Nancy Module that uses DataStax drivers to read data from Cassandra
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using Nancy;
using Nancy.ModelBinding;
using Cassandra.Data.Linq;
using Cassandra.Data;
using Cassandra;
@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;
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 / 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 -->
@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 / 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 / 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 / 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
" +