Skip to content

Instantly share code, notes, and snippets.

View nmccready's full-sized avatar

nmccready nmccready

View GitHub Profile
@sadache
sadache / gist:4714280
Last active July 14, 2022 15:09
Playframework: Async, Reactive, Threads, Futures, ExecutionContexts

Asynchronicity is the price to pay, you better know what you're paying for...

Let's share some vocabulary first:

Thread: The primitive responsible of executing code on the processor, you can give an existing (or a new) Thread some code, and it will execute it. Normally you can have a few hundreds on a JVM, arguments that you can tweak your way out to thousands. Worth noting that multitasking is achieved when using multiple Threads. Multiple Threads can exist for a single processor in which case multitasking happens when this processor switches between threads, called context switching, which will give the impression of things happenning in parallel. An example of a direct, and probably naive, use of a new Thread in Java:

public class MyRunnable implements Runnable {
  public void run(){
 System.out.println("MyRunnable running");
<!-- File: app/views/layouts/application.html.erb -->
<%= yield %>
@rcoup
rcoup / rsync_parallel.sh
Created April 10, 2013 21:52
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
#!/bin/bash
set -e
# Usage:
# rsync_parallel.sh [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes:
@nmccready
nmccready / start_locust
Created May 9, 2013 13:32
start script to kick off a master and then slaves via ssh across multiple machines
#!/bin/bash
#start script to kick off a master and then slaves via ssh across multiple machines
RUN_AS=${1:-$(whoami)}
SLAVE_CMD="nohup locust -f /opt/swarm//app1/some_locust_script.py --slave --master-host=testbox1.locust.com --host=http://someurlToHammer:9000 &>/dev/null &"
MASTER_CMD="nohup locust -f /opt/swarm/app1/some_locust_script.py --master --host=http://someurlToHammer:9000 &>/dev/null &"
start_instances()
{
@bsodmike
bsodmike / solutions.md
Last active June 3, 2022 08:33
Solutions to Lessons @ RegexOne.com
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active June 7, 2024 23:10
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
@seb
seb / sample.conf
Last active December 12, 2017 09:01
Nginx + Puma + Rails + Cache Configuration File Replace example.com.
upstream example.com {
server unix:///var/www/example.com/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name *.example.com;
return 301 http://example.com$request_uri;
}
@badsyntax
badsyntax / nodejs.pp
Created December 19, 2013 15:28
Puppet: Installing node.js via nvm
class nodejs {
exec { 'nvm-install':
command => '/usr/bin/curl https://raw.github.com/creationix/nvm/master/install.sh | /bin/sh',
creates => '/home/vagrant/.nvm',
user => 'vagrant',
environment => 'HOME=/home/vagrant',
require => Package['curl']
}
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active June 8, 2024 10:07
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k