This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def notify(title, msg = ''): | |
'''small osascript notification with proper quotes escaping. don't use this with user input!''' | |
clean_str = lambda x: x.replace('"', '\\"').replace('\'', '\'\\\'\'') | |
os.system('osascript -e \'display notification "{}" with title "{}"\''.format( | |
clean_str(msg), | |
clean_str(title) | |
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*** | |
* | |
* CACHE | |
* | |
* create the cache_directory BEFORE you use this cache. | |
* it doesn't generate it automatically to avoid possible bugs. | |
* | |
***/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# chmod +x setup.sh && ./setup.sh | |
# [!] only for testing! this is not stable or secure | |
# it takes some hours. | |
# it is available under http://<server-ip>:8080 | |
# | |
# make sure that you run ubuntu 16.04 | |
# you need minimum 25gb (10gb filled with build dependencies) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
def is_working_time(dt = None): | |
''' | |
is it currently working time? | |
tuesday at 8am - yes | |
saturday - no | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###### | |
# | |
# short snippet to send a mail with python | |
# with mail attachments | |
# | |
# - always handy to have such a code snippet | |
# - should work on python 2.x and 3.x | |
# - supports multiple recipients | |
# - based on https://docs.python.org/3.1/library/email-examples.html | |
# - please do proper error handling in production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Vue.js and Parse.Object | |
* | |
* Transform Parse.Object into POJO so we can use it in Vue.js | |
* Make it possible to use the Parse.Object and sync changes to the model data. | |
* Easily $fetch and $save model data. | |
* | |
* needs: | |
* - Lodash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
# scp_changed | |
Upload changed files in a git repository to a server that has a copy of the project | |
## installation | |
save it as scp_changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* in models.js (example) | |
**/ | |
import setup_object from './utils/setup_object' | |
var Model = Backbone.Model.extend({ | |
constructor: function() { | |
setup_object(this); | |
Backbone.Model.apply(this, arguments); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* if you try to apply font smoothing | |
* using css rules you'll notice that | |
* Chrome ignores it | |
* because antialiasing under Mac OSX | |
* is deprecated (for good reasons). | |
* | |
* This workaround fixes this. | |
* You should only use this if you | |
* know what implications it has, |