Skip to content

Instantly share code, notes, and snippets.

View yene's full-sized avatar
🏅
Best Developer of the Day

Yannick yene

🏅
Best Developer of the Day
View GitHub Profile
@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 / 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 / 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 / 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 / folderaction.js
Created June 25, 2015 17:28
Folder Action that copies Dropbox Public URL to clipboard
function run(input, parameters) {
dropboxURL = "https://dl.dropboxusercontent.com/u/XXXXXXX/FOLDER/";
currentApp = Application.currentApplication()
currentApp.includeStandardAdditions = true
inFile = input.toString()
inFile = basename(inFile)
inFile = encodeURIComponent(inFile)
//currentApp.displayAlert(dropboxURL + inFile);
currentApp.setTheClipboardTo(dropboxURL + inFile)
@yene
yene / netstat.c
Created June 24, 2015 09:02
Showing OS traffic
/*
* Print interface statistics in bytes per second
*
* Parameters:
* -t # Time interval to compute, default 2 seconds
* -i <ifname> Interface name, defaults to 'en0'
* -s Print raw stats
*
* Output: Two numbers separated by a space. First value is input bytes per
* second. Second value is output bytes per second
@yene
yene / gist:f7c625b8e77cf8df129b
Last active August 29, 2015 14:20
saving and restoring NSDate with NSUserDefaults
var startTime: NSDate
let defaults = NSUserDefaults.standardUserDefaults()
defaults.setObject(startTime, forKey: "startTime")
// ...
let defaults = NSUserDefaults.standardUserDefaults()
if let object: AnyObject = defaults.objectForKey("startTime") {
startTime = object as! NSDate
@yene
yene / now playing.scpt
Created April 18, 2015 16:56
Write current Spotify song to file for OBS
set oldTrack to ""
set current_user to do shell script "whoami"
set the_file to "/Users/" & current_user & "/NowPlaying.txt"
do shell script "touch " & POSIX path of the_file -- create file
repeat
if application "Spotify" is not running then
say "spotify is not running"
@yene
yene / deploy.sh
Created April 9, 2015 18:43
FTP upload master branch
#!/bin/bash
git clone -b master --single-branch . temp
cd temp
find . -type f -exec curl -u USER:PASSWORD --ftp-create-dirs -T {} ftp://server/path/to/www/{} \;
rm -rf temp
@yene
yene / generate-iOS-icons.sh
Last active December 14, 2017 14:38 — forked from marcuswestin/generate-iOS-app-icons.sh
generate iOS icons
#!/bin/bash
# pass in the file name of the source as first parameter
mkdir -p generated
rm generated/*
# remove alpha with a simple trick
sips -s format bmp "$1" --out tmp.bmp
sips -s format png tmp.bmp --out "$1"