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
| blueprint: | |
| name: Link On/Off State of Multiple Devices | |
| description: '## Link On/Off State of Multiple Devices v1.0.4 | |
| Select multiple entities to link their on/off state. If any selected entity is | |
| turned on or off, the other selected entities will be sent a matching on or off | |
| command. | |
| You can select any entity, but only entities supported by the `homeassistant.turn_on` |
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 woman() { | |
| if [ $# -eq 0 ]; then | |
| man | |
| else | |
| man $1 | head -n `expr \`man $1 | wc -l\` \* 77 / 100 ` | $PAGER | |
| fi | |
| } | |
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/env python2.7 | |
| from slacker import Slacker # https://github.com/os/slacker | |
| slack = Slacker('SLACK API TOKEN HERE') | |
| while True: | |
| line = raw_input() | |
| msg = 'A line was posted: %s' % line | |
| print msg | |
| slack.chat.post_message('@slackbot', msg) |
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
| the_post(); | |
| $children = new WP_Query( array('post_type' => 'page', 'post_parent' => get_the_ID() ); | |
| $ids = array(); | |
| if ($children->have_posts()) { | |
| while ($children->have_posts()) { | |
| $children->the_post(); | |
| array_push($ids, get_the_id()); | |
| } | |
| } |
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
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server ipv6only=on; | |
| root SITE_PATH_HERE; | |
| index index.php index.html index.htm; | |
| server_name SERVER_NAME_HERE; | |
| client_max_body_size 10M; |
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 "Backup perfomed at: `date +'%Y/%m/%d %H:%M'`" | |
| echo "Backup perfomed at: `date +'%Y/%m/%d %H:%M'`" >> backups.log | |
| # Make a backup | |
| cp -r ~/unleashed/world ~/unleashed/backups/world_`date +%Y_%m_%d_%H_%M` | |
| pushd ~/unleashed/backups | |
| # Keep only the latest 50 backups |
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
| // | |
| // Sources: | |
| // | |
| // http://benalman.com/news/2010/03/jquery-special-events/ | |
| // http://learn.jquery.com/events/event-extensions/ | |
| // https://github.com/jquery/jquery/blob/master/src/event.js#L549 | |
| // https://github.com/jquery/jquery/blob/master/src/event.js#L694 | |
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
| var data = { | |
| 'bone-spear': 1, | |
| 'bolas': 4, | |
| 'bullets': 30, | |
| 'rifle': 1, | |
| 'cured-meat': 38, | |
| 'steel-sword': 1, | |
| 'torch': 5, | |
| 'laser-rifle': 1, | |
| 'energy-cell': 7, |
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/env python2.7 | |
| #-*- coding:UTF-8 -*- | |
| import sys | |
| import collections | |
| letters = collections.Counter(list(''.join(sys.argv[1:]))) | |
| words = [word.strip() for word in open('/usr/share/dict/words').readlines() | |
| if word.find("'") == -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
| #include<stdio.h> | |
| const int BOWLS = 40; | |
| const int ORANGES = 9; | |
| int count = 0; | |
| // All the places in which an orange can't be placed are 1's | |
| int used[BOWLS]; | |
| // A list of the oranges already placed. |
NewerOlder