-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
#SingleInstance Force OnExit("cleanup") ; Cleans up temp files Return +^v::typewriter_send() ; Ctrl+Shift+v to paste as typewriter +^b::typewriter_send(1) ; Ctrl+Shift+b to break sending typewriter_send(opt:=0) { Static sending := 0 ; Prevents multi-sending , margin := 80 ; How many chars to type before the warning bell , breaker := 0 ; Breaks out of typewriter send opt ? breaker := 1 : "" ; Opt controllers breaker If sending ; If sending, go no further Return sending := 1 ; Start by setting sending to true ,txt := Clipboard ; Copy clipboard contents ,txt := StrReplace(txt, "`r`n", "`n") ; Replace CRLF with LF ,txt := StrReplace(txt, "`r", "`n") ; Replace CR with LF Loop, Parse, % txt ; Go through each letter { (A_Index = margin) ? typewrite("", "bell.wav") : "" ; When the right margin is hit, sound bell , (A_LoopField == "`n") ; If new line, send carriage return ? typewrite(A_LoopField, "cr.wav", 1) : typewrite(A_LoopField ; Else if space, send space sound , (A_LoopField == " " ? "space.wav": "hit.wav")) ; Else send key hit , Asc(A_LoopField) > 32 ; Fun addition that gives a 5% chance to double type a char ? (rand(1,100) > 95) ; If roll succeeds ? (typewrite(A_LoopField, "hit.wav") ; Send char again , typewrite("`b", "hit.wav")) : "" ; Then backspace it to correct the error }Until (breaker) ; If breaker gets set to true, break loop sending := 0, breaker := 0 ; Always set sending and breaker to false at the end } ; Ensures the temp ahk file doesn't get left cleanup() { typewrite(0,0,0,1) } ; Function to emulate a typewriter typewrite(char, file, all:=0, clean:=0) { Static path := A_AppData "\AHK_typewriter\" ; Path to store sound effect files , wpm_fast := 100 ; Minimum (fastest) words per minute , wpm_slow := 300 ; Maximum (slowest) words per minute , tmp := path "tmp.ahk" ; Set temp file , init := file_setup(path) ; Gets sound files at startup ; This is a hackey way of sending multiple sound files that overlap ; You could probably make some DLLCalls to do this better, ; but this straight up works without the extra work. FileDelete, % tmp ; Ensure file is deleted If clean ; Only time this fires is at script close ExitApp FileAppend, % "#NoTrayIcon`nSoundPlay, % """ ; Create a temporary ahk file to play the sound . path file """, 1", % tmp If all ; If the all option is true, it's a new line RunWait, % tmp ; Allow the full CR sound file to play before continuing Else Run, % tmp ; Otherwise, play the correct file SendEvent, % "{raw}" char ; Send char to coincide with sound playing If (rand(1,100) > 97) ; 3% chance that the typist got "distracted" Sleep, % rand(wpm_slow, wpm_fast) * 10 ; If distracted, wait 5 to 30 seconds Else Sleep, % rand(wpm_slow, wpm_fast) ; Else use normal words per minute } ; Random command as a function rand(min, max) { Random, r, % min, % max Return r } ; Makes sure the user has all 4 sound files downloaded file_setup(path) { url := "https://github.com/0xB0BAFE77/Repo_Depot/" . "raw/main/media/sound/typewriter/" , file_list := ["bell", "cr", "hit", "space"] For i, file in file_list { file .= ".wav" If FileExist(path file) Continue Else UrlDownloadToFile, % url file, % path file } }
Related posts
-
Show HN: Screencast and accesibility app: KeyPress OSD
-
KeyPress OSD – a unique OSD for screencasts; my first ever developed app
-
Show HN: Fixkey is a keyboard-focused AI copilot for writing
-
Automating Workday Job Application Forms
-
Wordstar-keys: Implement wordstar cursor control keys in Linux using xkb