forked from matryer/xbar-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # README.md
- Loading branch information
Showing
25 changed files
with
1,055 additions
and
84 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Bitstamp rate | ||
# BitBar plugin | ||
# Shows last BTC price (in USD) on Bitstamp exchange. | ||
# | ||
# <bitbar.title>Bitstamp last price plugin</bitbar.title> | ||
# <bitbar.version>v1.0</bitbar.version> | ||
# <bitbar.author>Damien Lajarretie</bitbar.author> | ||
# <bitbar.author.github>dlajarretie</bitbar.author.github> | ||
# <bitbar.desc>Shows last BTC price (in USD) on Bitstamp exchange.</bitbar.desc> | ||
# <bitbar.image>http://i.imgur.com/aQCqOW6.png</bitbar.image> | ||
# | ||
# by Damien Lajarretie | ||
# Based on Coinbase bitbar plugin by Mat Ryer | ||
# | ||
# Shows last BTC price (in USD) on Bitstamp exchange. | ||
# | ||
|
||
echo -n "Bitstamp: $"; curl -s "https://www.bitstamp.net/api/ticker/" | egrep -o '"last": "[0-9]+(\.)?([0-9]{0,2}")?' | sed 's/"last": //' | sed 's/\"//g' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/python | ||
# coding=utf-8 | ||
|
||
# <bitbar.title>Huobi last price plugin</bitbar.title> | ||
# <bitbar.version>v1.0</bitbar.version> | ||
# <bitbar.author>Sam Xie</bitbar.author> | ||
# <bitbar.author.github>mountain3th</bitbar.author.github> | ||
# <bitbar.desc>A very simple huobi last price display tool</bitbar.desc> | ||
# <bitbar.dependencies>python</bitbar.dependencies> | ||
# | ||
# by mountain3th/Sam Xie | ||
|
||
import urllib2 | ||
|
||
|
||
def price(): | ||
response = urllib2.urlopen('https://api.huobi.com/staticmarket/td_btc.html').read() | ||
lines = response.split('\n') | ||
last_line = lines[-2] | ||
last_second_line = lines[-3] | ||
open_price = float(lines[2]) | ||
last_price = float(last_second_line.split(',')[1]) | ||
current_price = float(last_line.split(',')[1]) | ||
return open_price, last_price, current_price | ||
|
||
def prices_output(): | ||
open_price, last_price, current_price = price() | ||
return u'火币网:¥%s%s %.2f' % (current_price, u'⬆️' if current_price > last_price else u'⬇️', (current_price - open_price) / open_price * 100) + '%' | ||
|
||
if __name__ == '__main__': | ||
print prices_output().encode('utf-8') |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# <bitbar.title>GitHub Watch</bitbar.title> | ||
# <bitbar.version>v0.1.0</bitbar.version> | ||
# <bitbar.author>D. Khamsing</bitbar.author> | ||
# <bitbar.author.github>dkhamsing</bitbar.author.github> | ||
# <bitbar.desc>Show GitHub stars ⭐️ for a list of repos</bitbar.desc> | ||
# <bitbar.image>http://i.imgur.com/z1qhSun.png</bitbar.image> | ||
# <bitbar.dependencies>ruby</bitbar.dependencies> | ||
# <bitbar.abouturl>https://github.com/dkhamsing</bitbar.abouturl> | ||
|
||
require 'open-uri' | ||
require 'json' | ||
|
||
REPOS = [ | ||
'dkhamsing/awesome_bot', | ||
'dkhamsing/open-source-ios-apps' | ||
] | ||
|
||
VERSION = '0.1.0' | ||
|
||
CONFIG_GITHUB_WATCH = 'stargazers_count' | ||
|
||
CONFIG_SYMBOL = '★' | ||
|
||
GITHUB_REPO_API = 'https://api.github.com/repos' | ||
|
||
def get_stars(repos) | ||
s = [] | ||
repos.each do |r| | ||
repo_url = "#{GITHUB_REPO_API}/#{r}" | ||
c = open repo_url | ||
j = JSON.parse c.read | ||
s.push j[CONFIG_GITHUB_WATCH] | ||
end | ||
s | ||
end | ||
|
||
def line(r, s) | ||
repo_url = "https://github.com/#{r}" | ||
puts "#{r} #{CONFIG_SYMBOL} #{s} | href=#{repo_url}" | ||
end | ||
|
||
def separator | ||
puts '---' | ||
end | ||
|
||
def version_title | ||
puts "GitHub Watch #{VERSION}" | ||
end | ||
|
||
# bitbar output | ||
begin | ||
get_stars(REPOS).each_with_index { |s, i| line REPOS[i], s.to_s } | ||
separator | ||
version_title | ||
rescue => e | ||
puts "#{CONFIG_SYMBOL} | color=red" | ||
puts "Error: #{e}" | ||
separator | ||
version_title | ||
exit | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
USER="username" | ||
PASS="password" | ||
BASE_URL="jenkins-address.com" | ||
PROJECTS=("project1" "project2") | ||
|
||
function displaytime { | ||
local T=$1/1000 | ||
local D=$((T/60/60/24)) | ||
local H=$((T/60/60%24)) | ||
local M=$((T/60%60)) | ||
local S=$((T%60)) | ||
local output="" | ||
|
||
if [[ $D -gt 0 || $H -gt 0 || $M -gt 10 ]] | ||
then | ||
output+=">10mn" | ||
else | ||
output+="${M}mn ${S}s" | ||
fi | ||
|
||
echo "${output} ago" | ||
} | ||
|
||
# beginning of display | ||
echo "Jenkins Status" | ||
echo "---" | ||
|
||
for project in "${PROJECTS[@]}" | ||
do | ||
output="${project}: " | ||
url="https://${USER}:${PASS}@${BASE_URL}/job/${project}/lastBuild/api/json?pretty=true" | ||
query=$(curl --insecure --silent "${url}" | tail -30) # take only the end of output | ||
|
||
success=$(echo "${query}" | grep "result" | awk '{print $3}') # grep the "result" line | ||
|
||
if [[ $success == *"SUCCESS"* ]] | ||
then | ||
output+='🔵 ' | ||
else | ||
output+='🔴 ' | ||
fi | ||
|
||
timestamp=$(echo "${query}" | grep "timestamp" | awk '{print $3}') # grep the "timestamp" line | ||
timestamp=${timestamp%?} # remove the trailing ',' | ||
currentTime=$(($(date +'%s * 1000 + %-N / 1000000'))) # generate a timestamp | ||
output+=" $(displaytime $(( currentTime - timestamp )))" | ||
echo "${output}" | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
# <bitbar.title>tail</bitbar.title> | ||
# <bitbar.version>v1.0</bitbar.version> | ||
# <bitbar.author>Mat Ryer</bitbar.author> | ||
# <bitbar.author.github>matryer</bitbar.author.github> | ||
# <bitbar.desc>Tails a text file, set `FILE` env var. Perfect for tailing logs in the menu bar.</bitbar.desc> | ||
# <bitbar.image>https://cloud.githubusercontent.com/assets/101659/12247623/b65b6f1e-b8ac-11e5-8ec2-6d9d885bfb6f.png</bitbar.image> | ||
# <bitbar.dependencies></bitbar.dependencies> | ||
# <bitbar.abouturl>https://github.com/matryer/bitbar-plugins/blob/master/Dev/Logs/tail.5s.sh</bitbar.abouturl> | ||
|
||
LINES=15 | ||
FILE="path/to/file/to/tail" | ||
|
||
echo -n "↧ " | ||
basename "$FILE" | ||
echo --- | ||
tail -n "$LINES" "$FILE" |
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
Oops, something went wrong.