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 / 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"
@yene
yene / pasteboard.go
Created January 15, 2015 14:25
call pasteboard on mac os x from go
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@yene
yene / git2nas.sh
Created January 5, 2015 12:13
Backup git repos to synology nas
#!/bin/ash
ssh git@ip expand > repos.txt
myarr=$(awk '{print $NF}' repos.txt)
counter=0
for i in $myarr
do
counter=$(($counter+1))
if [ "$counter" -eq 1 ] || [ "$counter" -eq 2 ]
then
@yene
yene / face.php
Created November 27, 2014 12:55
PHP mark faces in images
<?php
if (extension_loaded("facedetect")) {
echo "facedetect extension loaded \n";
} else {
echo "facedetect extension not loaded, can't do face detect \n";
}
$file = "haarcascade_frontalface_alt.xml";
@yene
yene / index.php
Created November 26, 2014 13:23
show SBB delay on a hardcoded connection
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SBB Verspätungen</title>
<!-- Normalize.css is a customisable CSS file that makes browsers render all elements more consistently and in line with modern standards. -->
<link rel="stylesheet" media="screen" href="https://raw.github.com/necolas/normalize.css/master/normalize.css">
<style>
@yene
yene / mirror.sh
Last active August 29, 2015 14:02
#!/bin/bash
/usr/bin/ssh git@op6 expand > repos.txt
myarr=($(awk '{print $NF}' repos.txt))
counter=0
for i in "${myarr[@]}"
do
counter=$(($counter+1))
if [ "$counter" -eq 1 ] || [ "$counter" -eq 2 ]
then
@yene
yene / gist:7840570
Last active December 30, 2015 14:09
Custom marked renderer for gist code quotes
var r = new marked.Renderer()
var oldCode = r.code;
r.code = function(code, lang) {
if (lang === "gist") {
return '<code gist="https://gist.github.com/' + code + '.json"></code>';
} else {
return oldCode(code, lang);
}
}
@yene
yene / index.php
Created June 3, 2011 14:39
simple language detection in php
<?php
define(DEBUG, 0);
$supported_languages = array("en", "de");
$default_language = "en";
$language = $default_language;
if (isset($_POST['lang']) && in_array($_POST['lang'], $supported_languages)) { // Detecting if param was set
$language = $_POST['lang'];
setcookie("language", $language, time()+ (3600 * 24 * 30)); // cache 30 days
if (DEBUG) echo "found parameter lang " .$language;
@yene
yene / gist:964741
Created May 10, 2011 15:53
pre-commit hook which uses clang static analyter before commit
#!/bin/sh
RESULT=$(xcodebuild -configuration Debug RUN_CLANG_STATIC_ANALYZER=YES)
if `echo ${RESULT} | grep "generated." 1>/dev/null 2>&1`
then
echo "commit failed: anaylzer error found"
exit 1
fi
@yene
yene / gist:944523
Created April 27, 2011 15:50
loading nib and obtaining ref to the nswindow, all in code
NSMutableArray* topLevelObjs = [NSMutableArray array];
NSDictionary* nameTable = [NSDictionary dictionaryWithObjectsAndKeys:self, NSNibOwner, topLevelObjs, NSNibTopLevelObjects, nil];
if (![[NSBundle mainBundle] loadNibFile:@"bla" externalNameTable:nameTable withZone:nil]) {
NSLog(@"trouble loading bla.xib");
return;
}
for (id object in topLevelObjs) {
if ([object isKindOfClass:[NSWindow class]]) {
[object makeKeyAndOrderFront:nil];
break;