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
| #!/usr/bin/python | |
| import subprocess | |
| import boto3 | |
| cw = boto3.client('cloudwatch', region_name='eu-west-1') | |
| ctn_ip = subprocess.check_output('curl --silent ifconfig.co', shell=True).strip() | |
| stats_lines = subprocess.check_output([ | |
| '/usr/bin/docker', | |
| 'stats', |
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
| Vue.component('chapters', { | |
| template: `<div v-if="chapters.length > 0" class="field"> | |
| <h2 class="ui header">Rearrange Chapters</h2> | |
| <p><i class="arrows alternate icon"></i> Tap on chapter to start moving</p> | |
| <div class="ui grid"> | |
| <div v-for="c in chapters" class="four wide column"> | |
| <div class="ui grid"> | |
| <div class="chapter" :class="{ 'twelve wide column': moving, 'sixteen wide column': !moving }"> | |
| <div class="ui card" @click="startMoving(c)"> | |
| <div class="image"> |
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 addHook(hook, eventName) { | |
| let event = window[eventName]; | |
| window[eventName] = function() { | |
| setTimeout(() => { | |
| try { | |
| hook.apply(null, arguments); | |
| } catch (e) { | |
| console.error(e); | |
| } |
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() { | |
| $.fireEvent = function(name, data) { | |
| var deferred = $.Deferred(), | |
| callback = 'cb' + Math.random().toString(36).substring(7); | |
| if (data) { | |
| data.callBackFunc = callback; | |
| data.callBack = callback; | |
| data.source = $.fireEvent.defaults.source; | |
| } |
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 string | |
| import random | |
| for x in range(1000): | |
| print(''.join(random.choices(string.ascii_lowercase + string.ascii_uppercase + string.digits, k=10))) |
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 ($) { | |
| var prefix = 'System:ds:'; | |
| function uniqueArray(ar) { | |
| var j = {}; | |
| ar.forEach(function (v) { | |
| j[v + '::' + typeof v] = v; | |
| }); |
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
| <?php if (count(get_the_category()) > 0): ?> | |
| <?php | |
| $german = false; | |
| $cats = get_the_category(); | |
| foreach ($cats as $cat) { | |
| if ($cat->name == "Deutsch") { | |
| $german = true; | |
| break; |
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 ($) { | |
| var isWin = typeof Ti.App.Platform !== 'undefined' | |
| && Ti.App.Platform === 'Win'; | |
| var currentResourceId = 0, | |
| deferredMap = {}; | |
| $.query = function (query, db) { | |
| var id = nextQueryId(), | |
| d = deferredMap[id] = $.Deferred(), |
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
| <?php | |
| $num = [ | |
| 1 => [2, 4], | |
| 2 => [1, 3, 5], | |
| 3 => [2, 6], | |
| 4 => [1 ,5 ,7], | |
| 5 => [2, 4, 6, 8], | |
| 6 => [3, 5, 9], | |
| 7 => [4, 8], |
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 | |
| # installation: | |
| # ~$: mv openurl.sh /usr/local/bin/openurl | |
| # ~$: chmod +x /usr/local/bin/openurl | |
| # | |
| # usage: openurl file:///Users/user01/Documents/Workspace/project%201/index.html | |
| # | |
| # credits: urlencode and urldecode copied from https://gist.github.com/cdown/1163649 |