mirror of
				https://forge.katzen.cafe/schrottkatze/nix-configs.git
				synced 2025-10-31 09:37:57 +01:00 
			
		
		
		
	lmao
This commit is contained in:
		
					parent
					
						
							
								224c80c420
							
						
					
				
			
			
				commit
				
					
						1cd19687be
					
				
			
		
					 21 changed files with 315 additions and 68 deletions
				
			
		
							
								
								
									
										41
									
								
								other/scripts/networkhooks/ccchh.nu
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								other/scripts/networkhooks/ccchh.nu
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | |||
| const wave_timeout = 15min; | ||||
| 
 | ||||
| def main [ | ||||
|   interface: string | ||||
|   type: string | ||||
| ] { | ||||
|   if not ('/var/lib/ccchh-winken/last' | path exists) { | ||||
|     mkdir '/var/lib/ccchh-winken'; | ||||
|     0 | into datetime | save '/var/lib/ccchh-winken/last' -f; | ||||
|   }  | ||||
| 
 | ||||
|   let $last_waved = open '/var/lib/ccchh-winken/last' --raw | into datetime; | ||||
| 
 | ||||
|   if ((date now) - $last_waved) > $wave_timeout { | ||||
|     if $type == "up" { | ||||
|       mullvad disconnect; | ||||
|       curl mqtt://mqtt.z9/winkekatze/katz9/eye/set -d (rand-color); | ||||
|       curl mqtt://mqtt.z9/winkekatze/Viktoria/eye/set -d (rand-color); | ||||
|       curl mqtt://mqtt.z9/winkekatze/allcats -d 'wink'; | ||||
|       mullvad connect; | ||||
| 
 | ||||
|       date now | save '/var/lib/ccchh-winken/last' -f; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| def rand-color [] { | ||||
|   const colors = [  | ||||
|       "blue" | ||||
|       "cyan" | ||||
|       "green" | ||||
|       "pink" | ||||
|       "red" | ||||
|       "white" | ||||
|       "yellow" | ||||
|   ]; | ||||
| 
 | ||||
|   $colors | get (random integer 0..(($colors | length) - 1)) | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Schrottkatze
				Schrottkatze