Skip to content

Instantly share code, notes, and snippets.

View lpradovera's full-sized avatar

Luca Pradovera lpradovera

View GitHub Profile
@lpradovera
lpradovera / gist:08c3779bdd9696a80a04888ca6e12434
Created February 24, 2022 20:27
Simple monitoring script
end=$((SECONDS+3600))
while [ $SECONDS -lt $end ]; do
MEMORY=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}')
CPU=$(top -bn1 | grep load | awk '{printf "%.2f%%\t\t\n", $(NF-2)}')
echo "$MEMORY$DISK$CPU"
sleep 5
done
@lpradovera
lpradovera / install_docker.sh
Last active May 9, 2018 11:35
Install Docker on Ubuntu on Digital Ocean as root
#!/bin/bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce

Magic words:

psql -U postgres

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

  • \q: Quit/Exit
  • \c __database__: Connect to a database
  • \d __table__: Show table definition including triggers
{
"fields": ["title", "des_com", "des_reg"],
"from": 0,
"size": 15,
"sort": [{
"_geo_distance": {
"geo_loc": {
"lat": 45.5786,
"lon": 8.0365
},
luca@luca-acer:~$ dig SOA eco-idee.it
; <<>> DiG 9.7.3 <<>> SOA eco-idee.it
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20929
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
;; QUESTION SECTION:
;eco-idee.it. IN SOA
[2011-08-30 15:43:47] wire DEBUG: SENDING: (/home/luca/.rvm/gems/ruby-1.9.2-p290@default/gems/blather-0.5.4/lib/blather/client/client.rb:145:in `write') <iq type="set" to="460d98e4-e9cb-4501-9454-f2b6857eeaab@127.0.0.1" id="blather000a"><answer xmlns="urn:xmpp:rayo:1"/></iq>
[2011-08-30 15:43:48] wire DEBUG:
------------------------------
[2011-08-30 15:43:48] wire DEBUG: STREAM IN: <iq type="result" id="blather000a" from="460d98e4-e9cb-4501-9454-f2b6857eeaab@127.0.0.1" to="usera@127.0.0.1/voxeo"/>
[2011-08-30 15:43:48] wire DEBUG: RECEIVING (iq) <iq type="result" id="blather000a" from="460d98e4-e9cb-4501-9454-f2b6857eeaab@127.0.0.1" to="usera@127.0.0.1/voxeo"/>
[2011-08-30 15:43:48] punchblock DEBUG: Command blather000a completed successfully
"*****************************************************************************************"
[2011-08-30 15:43:50] punchblock DEBUG: Sending IQ ID blather000c #<Punchblock::Component::Output voice=nil, ssml="", call_id="460d98e4-e9cb-4501-9454-f2b6857eeaab", component_
it "should allow nested SSML elements" do
doc = RubySpeech::SSML.draw do
voice :gender => :male, :name => 'fred' do
string "Hi, I'm Fred. The time is currently "
say_as :interpret_as => 'date', :format => 'dmy' do
"01/02/1960"
end
end
end
voice = SSML::Voice.new(:gender => :male, :name => 'fred', :content => "Hi, I'm Fred. The time is currently ")
require 'active_support/core_ext/class/inheritable_attributes'
module RubySpeech
module SSML
class Element < Niceogiri::XML::Node
@@registrations = {}
class_inheritable_accessor :registered_ns, :registered_name
# Register a new stanza class to a name and/or namespace
[general]
;realm=127.0.0.1
context=incoming
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
allowguest=no
disallow=all
allow=ulaw
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=================================-=================================-==================================================================================
pc nautilus-dropbox 0.6.9 Dropbox integration for Nautilus