Skip to content

Instantly share code, notes, and snippets.

View rtacconi's full-sized avatar

Riccardo Tacconi rtacconi

View GitHub Profile
@rtacconi
rtacconi / install-chef-12-6-0-amazon-linux
Last active October 29, 2020 13:58
Install chef server 12.6.0 on Amazon Linux
echo "127.0.0.1 AWSVC009 AWSVC009" >> /etc/hosts
yum update -y
wget https://packages.chef.io/stable/el/5/chef-server-core-12.6.0-1.el5.x86_64.rpm
rpm -Uvh chef-server-core-12.6.0-1.el5.x86_64.rpm
chef-server-ctl reconfigure
mkdir /home/ec2-user/cookbooks
chown ec2-user /home/ec2-user/cookbooks
mkdir /home/ec2-user/.chef
chown ec2-user /home/ec2-user/.chef
@rtacconi
rtacconi / gist:8ac389e243e8bbf7a836844a3ec53f3d
Last active October 27, 2020 13:30
Piping a subprocesses output directly to stdout (java/clojure)
; this is not async
(defn shell
[cmd]
(->> (.. Runtime getRuntime (exec cmd) getInputStream)
java.io.InputStreamReader.
java.io.BufferedReader.
line-seq
(map str)))
; or this is async, use this as script to test it:
@rtacconi
rtacconi / linked_list.py
Created August 8, 2020 14:13
Implementation of Singly linked list
class Node:
def __init__(self, data=None):
self.data = data
self.next = None
def __str__(self):
return str(self.data)
class SinglyLinkedList:
@rtacconi
rtacconi / retun_unique.py
Last active June 15, 2020 12:22
In each input list, every number repeats at least once, except for two. Write a function that returns the two unique numbers.
def retun_unique(lst):
return [i for i in lst if lst.count(i) <= 1]
return_unique([1, 9, 8, 8, 7, 6, 1, 6]) # -> [9, 7]
return_unique([5, 5, 2, 4, 4, 4, 9, 9, 9, 1]) # -> [2, 1]
return_unique([9, 5, 6, 8, 7, 7, 1, 1, 1, 1, 1, 9, 8]) # -> [5, 6]
@rtacconi
rtacconi / install_jenkins.sh
Last active April 5, 2019 11:52
Install Jenkins Centos 7
#!/bin/sh
yum install -y java
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum install -y jenkins
yum install -y git
service jenkins start/stop/restart
chkconfig jenkins on
@rtacconi
rtacconi / autotools.nix
Last active February 18, 2019 16:41 — forked from lucabrunox/autotools.nix
Nix pill 12
pkgs: attrs:
with pkgs;
let defaultAttrs = {
builder = "${bash}/bin/bash";
args = [ ./builder.sh ];
setup = ./setup.sh;
# binutils-unwrapped provides the ar utility
baseInputs = [ gnutar gzip gnumake gcc binutils-unwrapped coreutils gawk gnused gnugrep patchelf findutils ];
buildInputs = [];
system = builtins.currentSystem;
@rtacconi
rtacconi / cd_public_keys
Last active January 11, 2019 16:10
cd_public_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSNWB3aMMJ9skVQKZMzIMHBZaqzD0vdDMb/vEsxA9tWkC5ch7RHXlvT10RaAKQy4eGfL1Os2d9MACvZiqsJ68RzgqP4nWIA/F8kxsPHfBY1WJRKPn/nxW+HHisA2LUts/yIYuK6lszMj/UVFCiaIpd9VDe9MOq1sDHxMS4PnyaWwXIxQ9Ua8Ioj93J9ld2pFwQPSAhWuTg5H7k+MbQgdjNxrZyNNd5bbXQsAlpN7K4gtmf9MWhWpN8HoIDPnz/C/VnzcQasQnkYu4kuuI4yMo7dd4vbttWW5df8w0d1yHmfetglQbj1Ht6Y2fn/skUL7Deqf5JnZlR0Gti4VkoJwih vaevictis
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA8VVs+gk0ZFbNbx1tnRGTHFD2OBXGOW7yaMUWMXABF7ONM6iN7SwMdioFNvlPkha6UwPtXlYc+59fI21ExW4Th1IGfhanDMvV61AeR3JQmEuwljBAlEZ779OefupHaWwlMOWUBE7mHZCXgUHZbUom6sL8GCQ0smpnyuQNwcpMEN2YxhbU6d3gowKHgixiJXMkcRCqX5QHNtmVCh9kp6lJNoWrmLJT0W9d6aQhX+laui95D89cFifsyo8fHkADew3PIZ9qyqUTQUrP9MC5PFV9wUA9hds3PaMKbPsEh5a69s4MZ8PxK/Qq5t0FqZDp+3EqNzO1Nz2DkoHRt69aMjsGYw== root@f.ro
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArxPOycq84YnVKRQt3JIon0sgE8s1oPh2qwCISum77+9NMITZ37gS/+gTXgGcuIGPkz1GxGGg/giWqnw/t/XmGNoPD4rqT14EnXnh7wphl+ABxOwAn6NTyIR0VELhMLNvpj9C+VD8YGa9ICMkgAxIK9flI5E9aEgnja9AmaJ5el8jVO0cTTeijFvU228OzOV8gLvTxRjak+JqZ+
@rtacconi
rtacconi / build.gradle
Created April 5, 2016 10:48
gradle aws lambda jruby build
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
buildscript {
repositories { jcenter() }
dependencies {
/* check jruby-gradle.org for the latest release */
classpath "com.github.jruby-gradle:jruby-gradle-jar-plugin:1.0.1"
@rtacconi
rtacconi / Dockerfile
Created May 3, 2017 12:55
Alpine Linux, jemalloc, Ruby 2.4.1 segmentation fault
FROM alpine:3.4
# skip installing gem documentation
RUN mkdir -p /usr/local/etc \
&& { \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc
ENV RUBY_MAJOR 2.4
@rtacconi
rtacconi / gradle_jar_aws_lambda.txt
Created April 5, 2016 12:04
Gradle build of JRuby and AWS lambda
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
buildscript {
repositories { jcenter() }
dependencies {
/* check jruby-gradle.org for the latest release */
classpath "com.github.jruby-gradle:jruby-gradle-jar-plugin:1.0.1"