Skip to content

Instantly share code, notes, and snippets.

@muokicaleb
Last active September 18, 2021 22:02
Show Gist options
  • Save muokicaleb/f671c3627f39088691fbd385a7785688 to your computer and use it in GitHub Desktop.
Save muokicaleb/f671c3627f39088691fbd385a7785688 to your computer and use it in GitHub Desktop.
#include "DigiKeyboard.h"
#define KEY_TAB 0x2B
#define KEY_ESCAPE 0x29
void setup() {
DigiKeyboard.delay(1000); // 1s delay
// open terminal
DigiKeyboard.sendKeyStroke(KEY_T, MOD_ALT_RIGHT | MOD_CONTROL_LEFT);
DigiKeyboard.delay(500);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
}
void phantomCode(String filename){
DigiKeyboard.println("vim " +filename);
DigiKeyboard.delay(1000);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(1000);
DigiKeyboard.sendKeyStroke(KEY_I);
DigiKeyboard.delay(1000);
// code
DigiKeyboard.println("# Lol");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(1000);
// save
DigiKeyboard.sendKeyStroke(KEY_ESCAPE);
int randomWait = random(1000, 5000);
DigiKeyboard.delay(randomWait);
DigiKeyboard.println(":wq");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(2000);
}
void loop() {
phantomCode("hello.py");
phantomCode("hello.lisp");
phantomCode("hello.asm");
phantomCode("hello.lhs");
phantomCode("hello.pro");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment