Skip to content

Instantly share code, notes, and snippets.

View MoutPessemier's full-sized avatar
💻
Working as a Full Stack Developer @inthepocket

Mout Pessemier MoutPessemier

💻
Working as a Full Stack Developer @inthepocket
View GitHub Profile
@MoutPessemier
MoutPessemier / BrainfckCompiler.js
Created May 1, 2023 16:13
A small and simple Brainfck compiler function in javascript
const compile = (input) => {
const tape = new Array(10).fill(0);
let pointer = 0;
let isLooping = false;
let loopStack = [];
let innerLoops = 0;
let output = "";
for (let i = 0; i < input.length; i++) {
const c = input[i];
@MoutPessemier
MoutPessemier / FocusTrackerOSX.py
Last active May 1, 2023 16:12
A while back my macbook always lost focus to a background process and I wanted to figure out what was drawing it's attention. That's why I created this small piece of code that you run in the background until your focus switches and it prints out what is currently in focus.
#! /usr/bin/python
from AppKit import NSWorkspace
import time
from datetime import datetime
workspace = NSWorkspace.sharedWorkspace()
active_app = workspace.activeApplication()['NSApplicationName']
print('Active focus:' + active_app)
while True:
time.sleep(1)
prev_app = active_app