Skip to content

Instantly share code, notes, and snippets.

View yene's full-sized avatar
🏅
check the doubelido to see what I dideldi did

Yannick yene

🏅
check the doubelido to see what I dideldi did
View GitHub Profile
@yene
yene / tm-check.js
Last active August 29, 2015 14:25
Check when the last Time Machine Backup was and display notification
// use it in calender: http://apple.stackexchange.com/a/59265/14030
app = Application.currentApplication()
app.includeStandardAdditions = true
ObjC.import('Cocoa')
dict = $.NSDictionary.dictionaryWithContentsOfFile('/Library/Preferences/com.apple.TimeMachine.plist')
firstItem = dict.valueForKey('Destinations').firstObject
lastBackup = firstItem.valueForKey('SnapshotDates').lastObject
diff = lastBackup.timeIntervalSinceNow // in seconds
@yene
yene / dota2gamemodes.go
Last active March 16, 2023 15:57
Generate statistic of what Dota 2 game modes are played the most.
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"strconv"
@yene
yene / fallback.html
Created May 27, 2016 14:33
JS load fallback on errror
<!DOCTYPE HTML>
<html lang="en">
<head>
<script>
function fallback(e) {
var filename = e.src.split('/').reverse()[0];
document.write('<script src="/libs/' + filename + '"><\/script>');
}
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.14.2/react.min.js" onerror="fallback(this)"></script>
@yene
yene / cleanup.sh
Last active September 1, 2016 13:38
cleanup.sh
brew cleanup
rm -r ~/Library/Application\ Support/HandBrake/EncodeLogs/
rm -r ~/Library/Application\ Support/Spotify/PersistentCache/Update/
rm -r ~/Library/Application\ Support/uTorrent/
rm -r ~/Library/Application\ Support/com.evernote.EvernoteHelper/logs
find ~/Library/Application\ Support/Skype -name "media_messaging" -type d -exec rm -r "{}" \;
rm -r ~/Library/Application\ Support/1Password/Backups
rm -r ~/Library/Application\ Support/Sublime\ Text\ 3/Backup
@yene
yene / style.css
Last active August 1, 2016 18:34
CSS template
* {
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
height: 100vw;
width: 100vw;
}
@yene
yene / build.sh
Created August 7, 2016 19:11
Build and release
#!/bin/sh
APIKEY=$(<apikey.txt)
VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "Info.plist")
PREV_TAG=$(curl -s https://api.github.com/repos/yene/DisplayBrightness/releases/latest | python -c "import json,sys;obj=json.load(sys.stdin);print obj['tag_name'];")
if [ "$PREV_TAG" == "v$VERSION" ]; then
echo "Error: This version is already published!"
exit 1
fi
git push origin master
mkdir build
@yene
yene / laundy-sensor.ino
Created October 20, 2016 13:36
laundy-sensor.ino
// MPU6050 Includes
#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050.h"
// ESP8266 Includes
#include <ESP8266WiFi.h>
// DEFINE NODEMCU PINS
#define D0 16
@yene
yene / coffeemachinehomekit.md
Last active November 23, 2018 16:07
Coffee Machine as HomeKit Example, with how it can be rendered in Vue.js

A thought experiment to map a coffee machine to Apple HomeKits format.

{
  "name": "Machine A",
  "serialNumber": "A343-GXOERK",
  "model": "frank-17273-rev23",
  "modelFriendly": "Coffeemaker A232",
  "customerID": 1337,
 "characteristics": [
@yene
yene / macOS-naming.js
Created November 23, 2018 16:06
Quick and dirty functions to replicate macOS behaviour if filename is already taken.
var folderName = 'untitledfolder';
var nameTests = [
{
nr: 1,
fileSystemIn: [],
fileSystemOut: ['untitledfolder'],
},
@yene
yene / grabbug.go
Created April 27, 2019 15:40
grab bug
package main
import (
"log"
"github.com/cavaliercoder/grab"
)
func main() {
client := grab.NewClient()