Skip to content

Instantly share code, notes, and snippets.

@albertohm
albertohm / graphite.md
Last active February 4, 2019 23:59
Install and configure graphite on ubuntu

Install python-pip

sudo apt-get install python-pip libcairo2 python-cairo

Install Graphite and Dependencies

pip install carbon
pip install whisper
pip install django
pip install django-tagging
pip install graphite-web
@ayosec
ayosec / server_launcher.rb
Created May 22, 2013 14:27
Script to launch (and restart when stopped servers)
require "etc"
# Script used to launch servers, and track their status
groups = {}
pid = nil
uid = nil
ARGV.each do |argument|
@ayosec
ayosec / g.rb
Last active December 12, 2015 04:18
Gaussian-like distribution
def g(n, center, amplitude, total, density)
Math.sinh(density*((n.to_f - total / 2.0))/(total/2.0))/Math.sinh(density) * amplitude + center
end
N = 30
Density = 10
prev_value = nil
(0..N).each do |n|
value = g(n, 35, 10, N, Density)
print "%3d %.4f" % [n, value]
@rwjblue
rwjblue / readme.md
Last active May 13, 2016 18:10
Guide to using drip with JRuby

#Overview drip is an awesome command line tool that can be used to dramatically lower perceived JVM startup time. It does this by preloading an entirely new JVM process\instance and allowing you to simply use the preloaded environment. This has extraordinary results with jruby.

We reduced time to run rake environment from 13 seconds to a mere 3.5 seconds. This is actually at or near MRI 1.9.3p327 (with falcon patch) speeds!

Adding a few addition jruby options will reduce startup time even further (down to 1.69 seconds).

#Install Drip Install drip if you haven't already (see https://github.com/flatland/drip)

@ayosec
ayosec / README.md
Last active December 10, 2015 17:48
Basic client to get PivotalTracker stories, in a easy to read format.

List for PivotalTracker stories

Get the stories for your PitalTracker project.

Installation

  • Install httparty and term-ansicolor gems
  • Download the pt-list.rb file in this gist.
  • Set execution flag with chmod +x
  • Put it in some directory in your $PATH
@elimisteve
elimisteve / goroutines2.go
Last active February 18, 2024 01:52
Programming Challenge: Launch 4 threads, goroutines, coroutines, or whatever your language uses for concurrency, in addition to the main thread. In the first 3, add numbers together (see sample code below) and pass the results to the 4th thread. That 4th thread should receive the 3 results, add the numbers together, format the results as a strin…
// Steve Phillips / elimisteve
// 2013.01.03
// Programming Challenge: Launch 4 threads, goroutines, coroutines, or whatever your language uses for concurrency,
// in addition to the main thread. In the first 3, add numbers together (see sample code below) and pass the results
// to the 4th thread. That 4th thread should receive the 3 results, add the numbers together, format the results as
// a string (see sample code), and pass the result back to `main` to be printed.
//
// Do this as succinctly and readably as possible. _Go!_ #golang #programming #concurrency #challenge
package main
@torgeir
torgeir / #1 - Scala macros tutorial.md
Last active July 6, 2019 08:49
A quick howto on getting started with scala macros (from the scala macros paradise branch, using sbt and sbt gen-idea)

Scala macros tutorial, using sbt

The following steps executed in order will;

  • create the project file structure
  • set the sbt version
  • add the gen-idea sbt plugin (if you want to import your project into intellij)
  • create an sbt build, that builds the macros project prior to the macrostest project (so the regex macro is usable in the macrostest project)
  • create the macros project scala file
  • create the macrostest project scala file
@ayosec
ayosec / OpenSSL and RSA.md
Created December 17, 2012 21:43
Encrypt/descrypt with OpenSSL and RSA

OpenSSL and RSA

You can encrpt files using a private/public keys.

First, create the keys:

openssl req -x509 -nodes -days 100000 -newkey rsa:2048 \
  -keyout private.pem -out public.pem -subj /
@ayosec
ayosec / en.yml
Created October 18, 2012 05:47
POC: Type locales in Scala
package: myapp.foo.locales
en:
mailbox:
header:
title: "Your mailbox"
subtitle: "Read and send messages"
welcome: "Welcome %{user}!"
actions:
@ayosec
ayosec / paste_img.py
Created September 15, 2012 16:19
Create images from clipboard
#!/usr/bin/python
#
# Usage: python paste_img.py dest_file.png
#
# This program readd the image stored in the clipboard, and dumps it into a file
import gtk, pygtk
pygtk.require('2.0')
import sys