Skip to content

Instantly share code, notes, and snippets.

View Inobtenio's full-sized avatar

Kevin Martin Inobtenio

View GitHub Profile
@Inobtenio
Inobtenio / RemoteServerPC.ino
Last active January 16, 2020 08:33
Remote turn on and off a desktop PC whose motherboard was manually hacked. This is different from Wake-on-LAN.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ArduinoOTA.h>
#include <ESP8266Ping.h>
#include <ArduinoJson.h>
//const char* ssid = "...";
//const char* password = "...";
@Inobtenio
Inobtenio / make-service
Created September 9, 2019 00:13
Simple CLI tool to create a systemd service that executes on boot from any command. Usage: sudo bash make-service [name] [description] [command]
#!/bin/bash
cat > "/etc/systemd/system/${1}.service" << EOF
[Unit]
Description=$2
After=network-online.target
[Service]
Type=simple
User=%i
@Inobtenio
Inobtenio / playProperEndingTheme.js
Created June 25, 2019 19:37
Play proper Evangelion endings on Netflix.
const mediaName = 'Neon Genesis Evangelion'; // Works for romanian/latin alphabet based languages only
var isEvangelion = false;
var epNumber;
var audio;
var video;
var audioLastPosition = 0;
var episodes = {
"1": { 'endingThemeURL': 'https://instaud.io/_/3Rdt.mp3', 'secondsLeftToMuteVideo': 96.0, 'secondsLeftToStartTheme': 95.7 },
"2": { 'endingThemeURL': 'https://instaud.io/_/3Rdu.mp3', 'secondsLeftToMuteVideo': 96.0, 'secondsLeftToStartTheme': 95.7 },
"3": { 'endingThemeURL': 'https://instaud.io/_/3Rdv.mp3', 'secondsLeftToMuteVideo': 96.0, 'secondsLeftToStartTheme': 95.7 },
@Inobtenio
Inobtenio / playback.js
Last active January 18, 2018 19:34
Control video playback with your keys in case is not supported natively
$(document).keydown(function(event){
var player = $('video')[0]
if (event.keyCode == 39 || event.keyCode == 68){
player.currentTime = player.currentTime + 10
} else if (event.keyCode == 37 || event.keyCode == 65){
player.currentTime = player.currentTime - 10
} else if (event.keyCode == 32){
event.preventDefault();
if (player.paused){
player.play()
@Inobtenio
Inobtenio / dinoBot.js
Created October 27, 2017 03:42
A bot for the Google Chrome dinosaur game
var checkPixels = function(){
var pixelData = document.getElementsByClassName('runner-canvas')[0].getContext('2d').getImageData(220, 230, 1, 1).data;
if (pixelData.some(function(e) {return e>0})){
Runner.instance_.tRex.startJump()
}
}
var interval = setInterval(checkPixels, 10)
@Inobtenio
Inobtenio / goto
Created September 20, 2017 03:22
saveproj saves the project name and location to a file. goto takes you to the project you are looking for.
#!/bin/bash
RED='\033[0;31m'
PROJECT_NAME=$1
PROJECTS_REPOSITORY_FILE_FULL_PATH="/path/to/saveproj/output/file"
PROJECTS_FOLDER_FULL_PATH="/path/to/your/projects/folder"
if ! line=$(grep "\<$PROJECT_NAME\>" $PROJECTS_REPOSITORY_FILE_FULL_PATH)
then
echo -e "${RED}$PROJECT_NAME not found in projects list. You can create one by using the saveproj tool."
else
directory_name=${line##* }