- Mac OS X : F:lux https://justgetflux.com/
- Android : Twilight https://play.google.com/store/apps/details?id=com.urbandroid.lux
lundi 4 juillet 2016
Dimming screen / "night mode" for android or mac
mardi 14 juin 2016
MySQL to CSV file
SELECT order_id,product_name,qty
FROM orders
WHERE foo = 'bar'
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
TODO : There is still to find how to print the column titles along with the result...
lundi 29 février 2016
VirtualBox install / config de base
* Config Clavier Mac sous Debian :
https://lokan.fr/2013/12/11/configurer-correctement-son-clavier-mac-sous-debian/
XKBMODEL="pc105"
XKBLAYOUT="fr"
XKBVARIANT="mac"
XKBOPTIONS="lv3:switch,compose:lwin”
* Config redimensionner fenêtre VirtualBox
(non testé ) : https://forums.virtualbox.org/viewtopic.php?f=2&t=68966
* http://download.virtualbox.org/virtualbox/5.0.14/
* http://download.virtualbox.org/virtualbox/5.0.14/UserManual.pdf
* Be sure to have the kernel headers, gcc and other basic build-tools installed
apt-cache search/apt-get install build-essential linux-headers-$(uname -r) dkms
* If present, it should be in /media/cdrom (or /media/cdrom0)
cd /media/cdrom0
sh VBoxLinuxAdditions.run
* NB : you might need to reboot the host.
* You can now add some shared folders (for example). They will be owned by root with drwxrwx--- root vboxsf (group)
* Add user in group vboxsf :
sudo usermod cm -a -G vboxsf
mardi 26 janvier 2016
Monitoring : POC around Monit + M/Monit
Monit : "Agent" or "Slave", running on each server where monit his used.
https://mmonit.com/monit/
M/Monit : "Master" allowing to connect, get and coordinate events and actions to&from all monit agents connected.
https://www.mmonit.com/
mmonit manual :
https://mmonit.com/documentation/mmonit_manual.pdf
https://mmonit.com/wiki/Monit/ConfigurationExamples
idea 1 : how to enhance this project : contribute a "log snippet" =
along side with the "start/stop program" in the config file, add a "logfile path" configuration setup that would watch this file(s) and make it available to the agent, and then to the master.
idea 2 : interface monit & elasticsearch (or implement monit within elasticsearch ?)
-----
Other monitoring tools :
* Prometheus "
https://github.com/prometheus/prometheus
* Sensu : A monitoring framework that aims to be simple, malleable, and scalable
https://sensuapp.org/
https://github.com/sensu/sensu
* Ganglia
http://ganglia.info/
lundi 26 octobre 2015
Scripting : set variables depending how the where launched (terminal mode, cron/auto mode, ...)
You can use the tty tool to check if a script is called from the standard output :
if ! tty -s
then
exec >/dev/null 2>&1
else
MAIL_DEST="email@server.ext"
fi
- The command tty returns :
User Commands tty(1)
NAME tty - return user's terminal name
SYNOPSIS tty [-l] [-s]
DESCRIPTION The tty utility writes to the standard output the name of
the terminal that is open as standard input. The name that
is used is equivalent to the string that would be returned
by the ttyname(3C) function.
OPTIONS The following options are supported:
-l Prints the synchronous line number to which the
user's terminal is connected, if it is on an active
synchronous line.
-s Inhibits printing of the terminal path name, allow-
ing one to test just the exit status.
EXIT STATUS
The following exit values are returned:
0 Standard input is a terminal.
1 Standard input is not a terminal.
>1 An error occurred.
lundi 19 octobre 2015
MS Word shortcuts
- Shift + F3 : change the current word type case between ALLUPPER <-> alllower <-> Firstcharup.->->
- Shift + F4 / F5 : navigate 1 screen forward (f4) / backward (f5.
- Control + Y : repeat the last action performed.
mardi 29 septembre 2015
Gnuplot by line (instead of columns)
Gnuplot definition: (file myplotrow.gpl)
set terminal x11 1 noraise set autoscale set grid set xdata time set timefmt "%Y-%m-%d_%H:%M:%S" set format x "%m/%d\n%H:%M" plot "data.dat" \ using 1:(stringcolumn(2) eq "valAAA"? $3:1/0) title "A" lc rgb "blue",\ "" using 1:(stringcolumn(2) eq "valBBB"? $3:1/0) title "B" lc rgb "red",\ "" using 1:(stringcolumn(2) eq "valCCC"? $3:1/0) title "C" lc rgb "green",\ "" using 1:(stringcolumn(2) eq "valDDD"? $3:1/0) title "D" lc rgb "orange",\ "" using 1:(stringcolumn(2) eq "valEEE"? $3:1/0) title "E" lc rgb "purple",\ "" using 1:(stringcolumn(2) eq "valFFF"? $3:1/0) title "F" lc rgb "violet" pause 100 reread
That you can launch with :
gnuplot < myplotrow.gpl
Or, if you change the output in the first line :
set terminal postscript color
with :
gnuplot < myplotrow.gpl > myoutput.ps
Exemple values :
2015-09-24_10:00:00 valAAA 37.000 2015-09-24_10:00:00 valBBB 37.000 2015-09-24_10:00:00 valCCC 37.000 2015-09-24_10:00:00 valDDD 37.000 2015-09-24_10:00:00 valEEE 37.000 2015-09-24_10:00:00 valFFF 37.000 2015-09-24_13:30:00 valAAA 40.000 2015-09-24_13:30:00 valBBB 40.000 2015-09-24_13:30:00 valCCC 41.000 2015-09-24_13:30:00 valDDD 42.000 2015-09-24_13:30:00 valEEE 42.000 2015-09-24_13:30:00 valFFF 42.000 2015-09-25_02:00:00 valAAA 5.000 2015-09-25_02:00:00 valBBB 5.000 2015-09-25_02:00:00 valCCC 5.000 2015-09-25_02:00:00 valDDD 5.000 2015-09-25_02:00:00 valEEE 5.000 2015-09-25_02:00:00 valFFF 5.000 2015-09-25_03:30:00 valAAA 15.000 2015-09-25_03:30:00 valBBB 15.000 2015-09-25_03:30:00 valCCC 16.000 2015-09-25_03:30:00 valDDD 16.000 2015-09-25_03:30:00 valEEE 15.000 2015-09-25_03:30:00 valFFF 15.000 2015-09-25_05:30:00 valAAA 19.000 2015-09-25_05:30:00 valBBB 19.000 2015-09-25_05:30:00 valCCC 19.000 2015-09-25_05:30:00 valDDD 20.000 2015-09-25_05:30:00 valEEE 19.000 2015-09-25_05:30:00 valFFF 19.000 2015-09-25_06:00:00 valAAA 19.000 2015-09-25_06:00:00 valBBB 19.000 2015-09-25_06:00:00 valCCC 18.000 2015-09-25_06:00:00 valDDD 19.000 2015-09-25_06:00:00 valEEE 19.000 2015-09-25_06:00:00 valFFF 20.000References :
- Gnuplot terciary condition:
- Colors
lundi 21 septembre 2015
Flatten and XML file (perl)
PERL_CONVERT="use XML::Simple; print XMLout(XMLin('-', KeepRoot => 1), AttrIndent => 1, KeepRoot => 1, XMLDecl => '');"
To be used like this :
/usr/bin/perl -e "$PERL_CONVERT" > $TMPFILE
Whatever input you have (in XML), the goal is to have a "comparable" ouptut that will respect the XML structure :
FROM:
TO:
attr1="value1"
attr2="value2"
...
attr3="value3"
>
...
...
Specifically, this is really useful if you need to merge 2 different versions of your XML file, like for example in SVN.
vendredi 19 juin 2015
Ansible vs. Chef vs. Puppet vs. Salt
- [infoworld] Puppet vs. Chef : http://www.infoworld.com/article/2614204/data-center/puppet-or-chef--the-configuration-management-dilemma.html
- [infoworld] Review : Puppet vs. Chef vs. Ansible vs. Salt : http://www.infoworld.com/article/2609482/data-center/data-center-review-puppet-vs-chef-vs-ansible-vs-salt.html
- [infoworld] Review: Ansible orchestration is a veteran Unix admin's dream : http://www.infoworld.com/article/2612397/data-center/review--ansible-orchestration-is-a-veteran-unix-admin-s-dream.html
- [infoworld] Review: Salt keeps server automation simple : http://www.infoworld.com/article/2612536/data-center/review--salt-keeps-server-automation-simple.html
- Review: Puppet 3.0 pulls more strings http://www.infoworld.com/article/2611099/data-center/review--puppet-3-0-pulls-more-strings.html
jeudi 18 juin 2015
CVSS : Common Vulnerability Scoring System (v3) calculator
- Common Vulnerability Scoring System Version 3.0 Calculator (FIRST)
https://www.first.org/cvss/calculator/3.0 - Common Vulnerability Scoring System Version 2 Calculator (Nvd.Nist)https://nvd.nist.gov/CVSS-v2-Calculator