This file contains hidden or 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 imp | |
import importlib | |
import inspect | |
import glob | |
import requests | |
import os | |
def import_from_string(content, module_name, file_name=None): | |
if not file_name: | |
file_name = '{0}.py'.format(module_name) |
This file contains hidden or 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
[nodes:vars] | |
ansible_python_interpreter = ls /usr/bin/ | grep -E "^python([2-3](.[0-9])?)?$" | head -n 1 |
This file contains hidden or 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
try { | |
System.out.println("attempt to shutdown executor"); | |
executor.shutdown(); | |
executor.awaitTermination(5, TimeUnit.SECONDS); | |
} | |
catch (InterruptedException e) { | |
System.err.println("tasks interrupted"); | |
} | |
finally { | |
if (!executor.isTerminated()) { |
This file contains hidden or 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
/** | |
* Реализация API, не изменяйте ее | |
* @param {string} url | |
* @param {function} callback | |
*/ | |
function getData(url, callback) { | |
var RESPONSES = { | |
'/countries': [ | |
{name: 'Cameroon', continent: 'Africa'}, | |
{name :'Fiji Islands', continent: 'Oceania'}, |
This file contains hidden or 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
# Script dir for script relative path | |
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
// Basic long start = System.currentTimeMillis(); long end = System.currentTimeMillis(); | |
// Stopwatch | |
Stopwatch stopwatch = new Stopwatch(); | |
double time = stopwatch.elapsedTime(); | |
// #java #timer #stopwatch |
This file contains hidden or 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 | |
echo "=================================" | |
echo "Post-receive script: START" | |
WORK_TREE="/site/folder" | |
GIT_DIR="/home/git/repos/site.git" | |
while read oldrev newrev refname | |
do | |
branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
if [ $branch == "master" ]; then | |
echo "Branch determined as master." |
This file contains hidden or 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
function swap() { mv $1 $1._tmp; mv $2 $1; mv $1._tmp $2; } |
This file contains hidden or 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
# System | |
.DS_Store | |
Thumbs.db | |
.Trashes | |
._* | |
Icon | |
.AppleDouble | |
.LSOverride | |
# Editors |
NewerOlder