Skip to content

Instantly share code, notes, and snippets.

nmccready nmccready

Block or report user

Report or block nmccready

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nmccready / email-via-scala-ProcessBuilder.scala
Last active Mar 6, 2018
Cool way to send email via Scala executing bash / shell.
View email-via-scala-ProcessBuilder.scala
import sys.process._
val body = "junk email body"
val subject = "test email subject"
val commaDelimitedEmails = ","
//goal is to execute the same bash command without loading a file
//script would be identical to: echo body | mail -s subject addresses
Seq("echo", body) #| Seq("mail", "-s %s".format(subject), commaDelimitedEmails) !
from locust import Locust, TaskSet
urls = ["someurl1", "someurl2"]
lamda_set = {}
for url in urls:
lamda_set[lambda l: l.client.get(url)] = 1
import sys
import simplejson
import requests
import random
from urllib import quote
# pass in a single argument of a url that returns a json list of urls [ "url1","url2"]
def main(argv):
nmccready / start_locust
Created May 9, 2013
start script to kick off a master and then slaves via ssh across multiple machines
View start_locust
#start script to kick off a master and then slaves via ssh across multiple machines
SLAVE_CMD="nohup locust -f /opt/swarm//app1/ --slave --host=http://someurlToHammer:9000 &>/dev/null &"
MASTER_CMD="nohup locust -f /opt/swarm/app1/ --master --host=http://someurlToHammer:9000 &>/dev/null &"
nmccready / init_d_logg
Created May 16, 2013
Showing the possibilities of having a log friendly init.d script. At the same time this script still shows instant output as well if run directly. Overrides default echo and functions success and failure.
View init_d_logg
. /etc/init.d/functions
successVar="-ne \t\t\t\t\t[ \033[32mOK\033[0m ]\n"
failureVar="-ne \t\t\t\t\t[ \033[31mFailed\033[0m ]\n"
function success(){
echo $successVar
function failure(){
echo $failureVar
nmccready / Java Future to Scala Future in Ning
Created Jun 7, 2013
Convert Ning AsyncHandler to Scala Future with AsyncHttpClient
View Java Future to Scala Future in Ning
trait IHttpClient[T] {
def host: String
def port: Int
def get(uri: String): Future[T]
trait NingHttpClient extends IHttpClient[Response] {
nmccready / gist:5730187
Created Jun 7, 2013
HttpClient interface with multiple implementations Akka to use a TestActorRef, Spray and Ning
View gist:5730187
import scala.concurrent.duration._
import scala.concurrent.Future
import spray.http._
import spray.can.client._
trait SprayHttpClient extends IHttpClient[HttpResponse] {
val httpClient = DefaultHttpClient(system)
while (1) { toEcho=$(lsof -i:16868 | grep 16868); echo $toEcho; sleep 1 }
nmccready /
Created Jun 25, 2013
find and awk combination to search for a file
find . -name "*.pid" -print -exec awk '$9 != "" && n < 10 {print; n++}' {} \;
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
You can’t perform that action at this time.