I hereby claim:
- I am farzy on github.
- I am farzad (https://keybase.io/farzad) on keybase.
- I have a public key ASDGWND5gUrYGfJ6DIHefYpxOxLQ4tqfK8RA268kDFn4hgo
To claim this, I am signing this object:
// Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan. | |
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/ | |
// See page 20. | |
//!+ | |
// Server2 is a minimal "echo" and counter server. | |
package main | |
import ( |
I hereby claim:
To claim this, I am signing this object:
myMap :: (a -> b) -> [a] -> [b] | |
myMap f [] = [] | |
myMap f (x:xs) = f x : myMap f xs | |
-- > myMap (+2) [1..3] | |
-- [3,4,5] |
# Define a config file than can be an usual source, or a template URL: template:/// | |
define config_file($path = false, $source = false, $mode, $owner, $group) { | |
file {"$title": | |
mode => $mode, | |
owner => $owner, | |
group => $group, | |
} | |
if $path { | |
File["$title"]{ | |
path => $path, |
#!/bin/bash | |
# find-out-what-is-using-your-swap.sh | |
# -- Get current swap usage for all running processes | |
# -- | |
# -- rev.0.3, 2012-09-03, Jan Smid - alignment and intendation, sorting | |
# -- rev.0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output | |
# -- rev.0.1, 2011-05-27, Erik Ljungstrom - initial version | |
#!/bin/bash | |
# Get current swap usage for all running processes | |
# Erik Ljungstrom 27/05/2011 | |
# Modified by Mikko Rantalainen 2012-08-09 | |
# Pipe the output to "sort -nk3" to get sorted output | |
SUM=0 | |
OVERALL=0 | |
for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"` | |
do | |
PID=`echo $DIR | cut -d / -f 3` |
#Somewhere in the 1.8.x cycle it was decided to do deprecate with user.authenticate | |
#however it was not documented well, so we will try uer.login first, and fall | |
#back to user.authenticate as user.login does not exist in 1.8.3 | |
login_methods=["user.login","user.authenticate"] | |
begin | |
result = do_request(json_obj(login_methods.first,{'user'=>l_user,'password'=>l_password})) | |
@auth=result['result'] | |
#setup the version variables |
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# irb3 - Runs an IRB-esque prompt (but it's NOT really IRB!) over multiple | |
# versions of Ruby at once (using RVM) | |
# | |
# By Peter Cooper, BSD licensed | |
# | |
# Main dependency is term-ansicolor for each impl: | |
# rvm exec gem install term-ansicolor |
# Cette fonction permet de récupérer dans un screen détaché et réattaché | |
# la connexion à l'agent d'authentification SSH ainsi que le DISPLAY X11 | |
# s'il a été défini (respectivement "ssh -A" et "ssh -X"). | |
function ssh-screen-auth() { | |
# Variables locales dont un tableau | |
local SCREENPID SOCK DISP | |
local -a SCREENPIDS | |
# Cherche le pid de screen et vérifie qu'il n'y a qu'un seul screen, | |
# s'il y en a plusieurs on ne sait pas les choisir. | |
SCREENPIDS=($(pgrep -f "screen -(r|dr|DR)" -u $UID)) |