Skip to content

Silveira Neto Posts

“Baste a quem baste o que lhe basta
O bastante de lhe bastar!
A vida é breve, a alma é vasta;
Ter é tardar.”

Fernando Pessoa

find a process running a deleted library

sudo find /proc -maxdepth 2 -name maps -exec grep -HE ‘\(deleted\)’ {} \; | cut -d/ -f3 | sort -u | xargs –no-run-if-empty ps

Looking for libssl in specific:

sudo find /proc -maxdepth 2 -name maps -exec grep -HE ‘/libssl\.so.* \(deleted\)’ {} \; | cut -d/ -f3 | sort -u | xargs –no-run-if-empty ps

Killing all process using a deleted version of libssl:

sudo find /proc -maxdepth 2 -name maps -exec grep -HE ‘/libssl\.so.* \(deleted\)’ {} \;| cut -d/ -f3 | sort -u | xargs –no-run-if-empty sudo kill

heredoc to feed an interactive program

Let this interactive.sh be the interactive program:
[bash]#!/bin/sh
read input1
read input2
echo $input1 $input2
[/bash]

This is a script feed.sh (in the same directoty) that uses heredoc to feed two lines to interactive.sh:
[bash]#!/bin/sh
./interactive.sh << EOF
asdf
zxcv
EOF
[/bash]

It work as:
[bash]$ ./feed.sh
asdf zxcv
[/bash]

“and I know too well that these arguments from probabilities are impostors, and unless great caution is observed in the use of them they are apt to be deceptive-in geometry, and in other things too” Socrates, in Phaedo by Plato. 399 BC.

um brinde

Um bom motivo pra tomar uma hoje: há exatos 80 anos atrás era descriminalizado o consumo de álcool nos Estados Unidos.

É bem verdade que a descriminalização não eliminou os efeitos do abuso do álcool. Por outro lado conseguiu o que o que todo o aparato policial, jurídico e carcerário não conseguiu, acabar com os traficantes. O calcanhar de aquiles do crime organizado era justamente a economia. A mesma proibição que tentava inocuamente lhes destruir também lhes dava na prática um monopólio garantido pelo Estado. A sociedade escolheu devolver ao indivíduo a liberdade de fazer o bem ou o mal a si próprio (por exemplo, o alcoolismo) e criminalizar apenas a possibilidade de fazer mal ao próximo (por exemplo, dirigir alcoolizado). Admitiu-se o que hoje nos soa como óbvio: os males do consumo recreativo de álcool são muito inferiores aos males da proibição em si.

Eastern State Penitentiary, Philadelphia, Pennsylvania.
Replica da cela de Al Capone na Eastern State Penitentiary, Philadelphia, Pennsylvania. CC-BY-SA.

Um brinde, com a bebida alcoólica de sua escolha, preferencialmente não clandestina, produzida dentro de parâmetros de qualidade definidos pela sociedade, obtido em uma transação devidamente tributada pelo Estado, consumida por um adulto e de maneira responsável.

Saúde!

Jeep Wrangler ASCII Art Collection

Some ASCII/ANSI/Shift_JIS/Unicode art of Jeep Wranglers. They are easy to modify and introduce your own customizations.

These I found on the web:

  __________ 
 |          | 
 |______(*)_| 
 /\__----__/\ 
/_/()||||()\_\ 
|_\ o||||o /_| 
|----Jeep----| 
|_|        |_| 


                   _.------------------.
                 .'____________________|
                 //    _||||  | |  | | |
          ______//_\__j_|||"--" "--" | |  _
         /-----+-|p  ==,|||__________|_|-|W|
        _j,====. |b_____|||  _____     | |W|
       |_) ,---.`.`------'|.',---.`.___|_|W|
         `/ .-. \\`======__// .-. \`-----'""
          \ `-' / """""""   \ `-' /
           `---'             `---'     hjw

  ____        
 /_/CL\___     
 \_,.__,._)    
---`'--`'--MK  
  ____
 |_| L\___
 |_,.__,._)
---`'--`'--MK

/l ,[____],
l---L -O||||||O-
()_)-()_)-o-)_)

    ______ooooo
  /__|_|_,\____\,___
  |_---|_|__|---O|||O
_.(o)_)__(o)_)--o-)_) 

               ∩_∩
        // ̄ヽ_( ・(ェ)・)  ____
       | ̄ ̄|_ (⊃/ ̄ ̄ ̄(O|||||O)
 .⌒ヽ ,;;; | / ̄ヽ ||___|// ̄ヽ ̄| |||||/ヽ
 (";"':;.):;゙ |_| ◎ |___ | ◎ .| |=======
   ⌒;:ヽ;; ヽ_//     ヽ_// ヽ_//
~~~~´゙`゙゙´´ ~~~~゙`゙´``´゙`゙゙´´ ~~゙゙´``´`´ ~~~


,[____l,
_-o||||o-_
()_)¯¯ )_)

O|||||||O

•IIIIII•

This one I created:

 
 â—„
  ╽██████████████       
  ▓█ ██ █✌ຈل͜ຈ █▄▄▄▄▄
  ▓█████████████⚪║║║║⚪█ 
  ═█▓▓██████▓▓▀████ºº███▀
    â–“â–“ â–“â–“   â–“â–“       â–“â–“

This one is a remix of one from hjw (Hayley Jane Wakenshaw) with an extra door, i.e. the Jeep Wrangler Unlimited.


                   _.---------------------.
                 .'_______________________|
                 //    _|||    || |   | | |
          ______//_\__j_|||____|| "---" | |  _
         /-----+-|p  ==,|||p ==,|_______|_|-|W|
        _j,====. |b_____|||b    /_____    | |W|
       |_) ,---.`.`------'|----.',---.`.__|_|W|
         `/ .-. \\`======__====// .-. \`---'""
          \ `-' / """""""  """" \ `-' /
           `---'                 `---'  

A remix of this post from @TwitAA_bot:

  __________ ⌒彡
 |          |冫、)
 |__________|` /
 /\__----__/\ /
/_/()||||()\_\
|_\ o||||o /_|
|------------|
|_|        |_|

Sources:

if host pings execute command

[bash]#!/bin/sh
HOST="silveiraneto.net"
if ping -c 1 $HOST > /dev/null
then
echo your command
fi
[/bash]

  • replace silveiraneto.net for your desired hostname or ip
  • ping sends only one package (-c 1) and ignores the text output
  • a ping is successful returns 0 and the if proceeds
  • replace the echo line with your command

printing only odd or even lines using sed

$ cat AtoF
A
B
C
D
E
F

Print only odd lines

sed -n 'p;n' AtoF
A
C
E

-n suppress automatic printing of pattern space, p print the current pattern space, n read/append the next line of input into the pattern space.

Alternatively:

$ sed -n 1~2p AtoF
A
C
E

-n suppress automatic printing of pattern space, 1~2 from the 1st line match every line every 2 steps, p print the current pattern space. sed -n 0~p has the same effect . print only the even lines.

Print only even lines

$ sed -n 'n;p' AtoF 
B
D
F

or

$ sed -n 2~2p AtoF
B
D
F

0~2p would also work. I prefer