Limit rate of mail sent by motion detection daemon (motiond) for webcam surveillance

Maybe you use the “on_picture_save” to send yourself an e-mail with motiond when your webcam detect an  intruder. But when someone enters, you’ll receive a lot of pictures. And if it was just you forgetting to stop the detection before entering, your smartphone will become a christmas tree for nothing…

I just published my last program “limitrate” on Github :

https://github.com/tbarbette/limitrate

This programs allows you to limit the rate of launching a certain command. Instead of launching

/usr/bin/program argument1 argument2

call :

limitrate 30 “/usr/bin/program % argument2” argument1

To launch only this command at maximum once every 30 seconds. If you call multiple times the last line in 30 seconds, limitrate will run the command only after 30 seconds replacing the “%” by the concatenation of all “argument 1”. For example to send an alert e-mail containing files (for example webcam picture) at max every 30 seconds :

10:24:30 : limitrate 30 "echo \"Alert!\" | mailx % destination@mail.com" "-A /path/to/file1"
--> Send a mail with file1
10:24:32 : limitrate 30 "echo \"Alert!\" | mailx % destination@mail.com" "-A /path/to/file2"
10:24:38 : limitrate 30 "echo \"Alert!\" | mailx % destination@mail.com" "-A /path/to/file3"
10:24:41 : limitrate 30 "echo \"Alert!\" | mailx % destination@mail.com" "-A /path/to/file4"
10:25:05 : limitrate 30 "echo \"Alert!\" | mailx % destination@mail.com" "-A /path/to/file5"
--> Send a mail with file 2,3,4 and 5

Example configuration for motion detection daemon (Camera surveillance) :

on_picture_save /usr/local/bin/limitrate 15 “echo \”See attachment below.\” | mailx -s ‘Motion in the saloon !’ %destination@tombarbette.be” “-A %f”

When an intrusion is detected, you’ll receive a first e-mail with one image. 15 seconds later you’ll receive all the new images in only one mail, and so on.

Installing Spotify 9.10 (may 20), 9.11 (july 2) on fedora 20 64 bits

UPDATE : Tested for 9.11 on July 2

 

Remove any old version of spotify :

yum remove “*spotify*”

rm -rf /usr/local/share/spotify*

 

Remove any configuration file of the last spotify version :

rm -rf /home/$USER/.config/spotify

rm -rf /home/$USER/.cache/spotify

 

Download the debian package at http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.10.17.g4129e1c.78-1_amd64.deb  http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.11.26.g995ec04.78-1_amd64.deb:

wget http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_0.9.11.26.g995ec04.78-1_amd64.deb

 

Install alien to convert the deb to RPM :

sudo yum install alien

 

Convert the deb to RPM with alien :

fakeroot alien -r spotify-client_0.9.10.17.g4129e1c.78-1_amd64.deb

 

Install the rpm :

sudo rpm -ivh –nodeps –force spotify-client-0.9.10.17.g4129e1c.78-2.x86_64.rpm

 

You will very probably have problems of dependencies to old libraries when launching spotify, like for libssl.so.1.0.0 , libudev.so.0 and libcrypto.so.1.0.0, I made a tarball with them.

 

Download oldlibs.tar :

wget https://www.tombarbette.be/wp-content/uploads/2014/05/oldlibs.tar.gz

 

Untar them :

tar -zxvf oldlibs.tar.gz

 

Copy them to /usr/lib64 :

cp -rf oldlibs/* /usr/lib64/

 

Remove the tarball :

rm -rf oldlibs*

 

If you don’t have any shorcut to launch spotify, copy the desktop entry :

cp -rf /opt/spotify/spotify-client/spotify.desktop /usr/share/applications/

 

If when you type “spotify” it doesn’t launch anything (and say this command is not found) :

sudo ln -s /opt/spotify/spotify-client/spotify /usr/bin/spotify

SourceForts Console commands

SourceForts is really a great mod for Half-Life 2 multiplayer, featuring a construction phase with blocks and panels before a combat phase. But the wiki has died a long time ago, and I decided to copy a save of the console commands here, as it’s not findable anymore.

Common Commands

Phase Limits

  • addtime [integer] Adds time (in seconds) to the current phase (can remove time too if integer is negative)
  • sf_build_long_length Length of the long Build Phase in seconds. Default 600
  • sf_build_short_length Length of the short build phase in seconds. Default 240
  • sf_combat_length Length of Combat Phase in seconds. Default 600
  • togglephase Changes the phase (either from build to fight or vice versa)

Match Limits

  • sf_roundlimit Number of rounds (cycles of Build / Combat) a map is played for. Default 4
  • sf_scorelimit [integer] Amount of points for a team to win the game. Default 1000
  • map_restart cmd – Completely restarts game, all scores returned to zero and all blocks removed.

Team Limits

  • sf_forcebalance Default : 1 – Force team balancing on connect. While on, you can only join the team with the least players.
  • sf_team_blocklimit [integer] Sets the blocklimit for both teams
  • sf_team_autoassign [0/1] Setting of 1 forces joining players to join smallest team

Blocks

  • sf_block_damage_multiplier Default : 3 – Multiplier of damage dealt to blocks by weapons. Higher number = blocks are easier to destroy.
  • sf_block_extra_force Default : 10 – Physics damage multiplier if hit by a block in combat.
  • sf_block_health Default : 6000 – Block damage health
  • sf_block_unfreeze_health Default : 1250 – Block unfreeze health, basically sets the time it takes to unfreeze a block.
  • sf_combat_freeze_friendly Default : 6 – Time in seconds to freeze a friendly block
  • sf_combat_unfreeze_enemy Default : 12 – Time in seconds to unfreeze an enemy block
  • sf_combat_unfreeze_friendly Default : 4 – Time in seconds to unfreeze a friendly block.
  • sf_freeze_continue_distance_combat Default : 16 – How far, in units, you have to be from a block to freeze it.
  • sf_freeze_continue_player_move_distance_combat Default : 16 – How far, in units, you can move from a block while freezing it without stopping.
  • sf_freeze_distance_build Default : 600 – How far, in units, you can freeze/unfreeze blocks in build phase
  • sf_freeze_starting_distance_combat Default : 128
  • sf_repair_delay Default : 0 – How long, after holding fire, it takes for you to start repairing a block (obsolete)
  • sf_repair_distance Default : 96 – How far you can be from a block to repair it.
  • sf_repair_increment Default : 45 – How many HP you return to a block while repairing

Class Settings

  • sf_armor_builder Default : 20Engineer armour
  • sf_armor_heavysoldier Default : 75Soldier armour
  • sf_armor_rocketeer Default : 40Rocketeer armour
  • sf_armor_scout Default : 15Scout armour
  • sf_armor_sniper Default : 0Sniper armour
  • sf_health_builder Default : 80 – Engineers health
  • sf_health_heavysoldier Default : 100 – Soldiers health
  • sf_health_rocketeer Default : 100 – Rocketeers health
  • sf_health_scout Default : 100 – Scouts health
  • sf_health_sniper Default : 75 – Snipers health
  • sf_player_limits_enabled Default : 1 – Enables/disables percentage based class limiting
  • sf_player_limits_engineer_percentage Default : 75 – Percentage limit for engineer
  • sf_player_limits_rocketeer_percentage Default : 60 – Percentage limit for rocketeer
  • sf_player_limits_scout_percentage Default : 100 – Percentage limit for scout
  • sf_player_limits_sniper_percentage Default : 25 – Percentage limit for sniper
  • sf_player_limits_soldier_percentage Default : 66 – Percentage limit for soldier
  • sf_run_builder Default : 0
  • sf_run_heavysoldier Default : 0
  • sf_run_rocketeer Default : 1
  • sf_run_scout Default : 1
  • sf_run_sniper Default : 0
  • sf_sprint_builder Default : 1
  • sf_sprint_drain_builder Default : 1
  • sf_sprint_drain_heavysoldier Default : 1
  • sf_sprint_drain_rocketeer Default : 1
  • sf_sprint_drain_scout Default : 0
  • sf_sprint_drain_sniper Default : 1
  • sf_sprint_heavysoldier Default : 1
  • sf_sprint_rocketeer Default : 1
  • sf_sprint_scout Default : 1
  • sf_sprint_sniper Default : 1

Flag Settings

  • sf_flag_drop_distance Default : 50 – How far away from you the flag is dropped if you drop it.
  • sf_flag_returntime Default : 30 – Time in seconds for the flag to return itself to its base.
  • sf_flag_x Default : 0 – Unknown
  • sf_flag_y Default : 0 – Unknown
  • sf_flag_z Default : 100 – Unknown

League Commands

  • league_flip cmd – Flips teams over, while maintaining scores.
  • league_flipscores cmd – Flips scores only
  • league_flipteams cmd – Flips teams only

Map Elements

  • sf_charger_armor_increment Default : 2 – Suit charger speed
  • sf_charger_health_increment Default : 2 – Health charger speed

Undocumented / Beta Commands

  • sf_ar2_range1_damage Default : 0 – Beta cvars used to test the dissipating power/range ratios on the AR2.
  • sf_ar2_range1_distance Default : 1000 – See above.
  • sf_ar2_range2_damage Default : 0 – See above.
  • sf_ar2_range2_distance Default : 2000 – See above.
  • sf_deny_respawn Default : 0 – Unknown, probably beta command.

Weapon Settings

  • sf_damage_crossbow Default : 100Crossbow damage
  • sf_damage_rpg Default : 125RPG damage (if hit directly. Damage dissipates the further from explosion you are)
  • sf_grenade_throw_force_multiplier Default : 800 – Controls range of grenades

Half Life 2 Deathmatch Commands

For a more complete list of console commands for Half-Life 2, see the HL2World wiki. Some of the most common and useful commands are shown below.

Useful Commands

  • sv_cheats Default : 0 – Server setting that turns cheat mode on or off.
  • sv_lan Default : 0Server setting, value of 0 is an internet server, 1 is a LAN server.
  • ip Default : localhostServer setting, needs to be changed to global IP address on servers utilizing routed Internet connections.

Using Cheat Codes

The following commands require that the server have cheats enabled.

  • impulse 101 cmd – Gives you one of every weapon. Needs cheats
  • impulse 200 cmd – Removes your HUD good for taking screenshots. Needs cheats
  • impulse 203 cmd – Removes an entity, used for removing SourceForts blocks. Needs cheats Warning: Using this on players will crash your server

Spawning Blocks

If the cheat mode is turned on players can give themselves blocks, without using a blockspawner. This adds to the blueteams block limit, so it is considered a cheat.

*give prop_block_2d_1x2
*give prop_block_2d_2x3
*give prop_block_2d_1x5
*give prop_block_3d_1x2
*give prop_block_3d_1x1