Remove all stuff that I won't use.
Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
This commit is contained in:
62
bin/cloudapp
62
bin/cloudapp
@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
#
|
||||
# cloudapp
|
||||
# Zach Holman / @holman
|
||||
#
|
||||
# Uploads a file from the command line to CloudApp, drops it into your
|
||||
# clipboard (on a Mac, at least).
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# cloudapp drunk-blake.png
|
||||
#
|
||||
# This requires Aaron Russell's cloudapp_api gem:
|
||||
#
|
||||
# gem install cloudapp_api
|
||||
#
|
||||
# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of:
|
||||
#
|
||||
# email
|
||||
# password
|
||||
|
||||
require 'rubygems'
|
||||
|
||||
['json', 'cloudapp_api'].each do |gem|
|
||||
begin
|
||||
require gem
|
||||
rescue LoadError
|
||||
puts "You need to install #{gem}: gem install #{gem}"
|
||||
exit!(1)
|
||||
end
|
||||
end
|
||||
|
||||
config_file = "#{ENV['HOME']}/.cloudapp"
|
||||
unless File.exist?(config_file)
|
||||
puts "You need to type your email and password (one per line) into "+
|
||||
"`~/.cloudapp`"
|
||||
exit!(1)
|
||||
end
|
||||
|
||||
email,password = File.read(config_file).split("\n")
|
||||
|
||||
if ARGV[0].nil?
|
||||
puts "You need to specify a file to upload."
|
||||
exit!(1)
|
||||
end
|
||||
|
||||
urls = []
|
||||
ARGV.each do |x|
|
||||
CloudApp.authenticate(email,password)
|
||||
puts "Attempting to upload #{x}"
|
||||
url = CloudApp::Item.create(:upload, {:file => x}).url
|
||||
|
||||
# Say it for good measure.
|
||||
puts "Uploaded #{x} to #{url}"
|
||||
|
||||
# Get the embed link.
|
||||
url = "#{url}/#{ARGV[0].split('/').last}"
|
||||
urls << url
|
||||
end
|
||||
|
||||
# Copy it to your (Mac's) clipboard.
|
||||
`echo '#{urls.join(',')}' | tr -d "\n" | pbcopy`
|
110
bin/color.js
110
bin/color.js
@ -1,110 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* HTML color converter
|
||||
* Convert #hex colors to HSL/HSLA (by default) or RGB/RGBA (if `--rgb` key specified).
|
||||
*
|
||||
* Usage: color [--rgb] [#]dead00 [alpha]
|
||||
*
|
||||
* Author: Artem Sapegin, sapegin.me
|
||||
* Based on https://github.com/LeaVerou/CSS.coloratum
|
||||
*/
|
||||
|
||||
//jshint node:true
|
||||
|
||||
var format = 'hsl';
|
||||
var args = process.argv.splice(2);
|
||||
if (!args.length) helpme();
|
||||
|
||||
if (args[0] === '--rgb') {
|
||||
format = 'rgb';
|
||||
args = args.splice(1);
|
||||
}
|
||||
if (!args.length) helpme();
|
||||
|
||||
var rgb = hex2rgb(args[0]);
|
||||
if (!rgb) helpme();
|
||||
|
||||
var alpha = args[1];
|
||||
|
||||
if (format === 'hsl') {
|
||||
console.log(toHslString(rgb2hsl(rgb), alpha));
|
||||
}
|
||||
else {
|
||||
console.log(toRgbString(rgb, alpha));
|
||||
}
|
||||
|
||||
|
||||
function helpme() {
|
||||
console.log('Usage: color [--rgb] [#]dead00 [alpha]');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function hex2rgb(rgbString) {
|
||||
// Remove leading `#`
|
||||
rgbString = rgbString.replace(/^#/, '');
|
||||
|
||||
// Parse `dead00` and `f00`
|
||||
var channels = [];
|
||||
if (rgbString.length === 3) {
|
||||
channels = rgbString.match(/([0-9a-f])/ig);
|
||||
channels = channels.map(function(hex) {
|
||||
return hex + hex;
|
||||
});
|
||||
}
|
||||
else {
|
||||
channels = rgbString.match(/([0-9a-f]){2}/ig);
|
||||
}
|
||||
if (channels.length !== 3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Convert to integers
|
||||
channels = channels.map(function(hex) {
|
||||
return parseInt(hex, 16);
|
||||
});
|
||||
|
||||
return channels;
|
||||
}
|
||||
|
||||
function rgb2hsl(rgb) {
|
||||
rgb = rgb.map(function(a) {
|
||||
return a / 2.55;
|
||||
});
|
||||
|
||||
var hsl = [];
|
||||
var max = Math.max.apply(Math, rgb);
|
||||
var min = Math.min.apply(Math, rgb);
|
||||
|
||||
hsl[2] = Math.round((min + max)/2);
|
||||
|
||||
var d = max - min;
|
||||
|
||||
if(d !== 0) {
|
||||
hsl[1] = Math.round(d*100 / (100 - Math.abs(2*hsl[2] - 100))) + '%';
|
||||
|
||||
switch(max){
|
||||
case rgb[0]: hsl[0] = (rgb[1] - rgb[2]) / d + (rgb[1] < rgb[2] ? 6 : 0); break;
|
||||
case rgb[1]: hsl[0] = (rgb[2] - rgb[0]) / d + 2; break;
|
||||
case rgb[2]: hsl[0] = (rgb[0] - rgb[1]) / d + 4;
|
||||
}
|
||||
|
||||
hsl[0] = Math.round(hsl[0]*60);
|
||||
}
|
||||
else {
|
||||
hsl[0] = 0;
|
||||
hsl[1] = '0%';
|
||||
}
|
||||
|
||||
hsl[2] += '%';
|
||||
|
||||
return hsl;
|
||||
}
|
||||
|
||||
function toRgbString(rgb, alpha) {
|
||||
return 'rgb' + (alpha < 1 ? 'a' : '') + '(' + rgb.join(',') + ((alpha < 1 ? ',' + alpha : '') + ')').replace(/\b0\./, '.');
|
||||
}
|
||||
|
||||
function toHslString(hsl, alpha) {
|
||||
return 'hsl' + (alpha < 1 ? 'a' : '') + '(' + hsl.join(',') + ((alpha < 1 ? ',' + alpha : '') + ')').replace(/\b0\./, '.');
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Convert font to set of SVG files
|
||||
|
||||
command -v fontforge >/dev/null 2>&1 || { echo >&2 "fontforge not installed."; exit 1; }
|
||||
|
||||
fontforge -lang=ff -c 'Open($1); SelectWorthOutputting(); foreach Export("svg"); endloop;' $@
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Print random domain from list of domains prohibited in Russia.
|
||||
# http://bolknote.ru/2013/01/10/~3831#05
|
||||
|
||||
domain=$(curl -so- http://flisti.ru/stop-list.txt | iconv -f cp1251 | awk -F'[\t\.]' 'BEGIN {srand()} $3 {print rand(), $3}' | sort -n | tail -1)
|
||||
php -r '$s=explode(" ", $argv[1]); echo mb_convert_case("${s[1]}!\n", MB_CASE_TITLE, "UTF-8");' "$domain"
|
@ -1,72 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#
|
||||
# Markdown to Aegea blog engine converter
|
||||
# Author: Artem Sapegin (sapegin.me)
|
||||
#
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import cgi
|
||||
|
||||
|
||||
def main():
|
||||
filename = sys.argv[1]
|
||||
if not filename:
|
||||
sys.exit('Usage: %s <filename>' % os.path.basename(__file__))
|
||||
|
||||
try:
|
||||
file = open(filename, 'r')
|
||||
except IOError:
|
||||
return []
|
||||
|
||||
print(process(file.read()))
|
||||
|
||||
|
||||
def process(text):
|
||||
# Preserve code blocks
|
||||
blocks = {}
|
||||
|
||||
def store_code_blocks(m):
|
||||
key = r'<%s>' % (len(blocks))
|
||||
value = [m.group(1), m.group(2)]
|
||||
blocks[key] = value
|
||||
return key
|
||||
|
||||
text = re.sub(r'```(\w+)\n([\w\W]+?)\n```', store_code_blocks, text)
|
||||
|
||||
# Process lines
|
||||
lines = text.split('\n')
|
||||
new_lines = []
|
||||
for line in lines:
|
||||
new_lines.append(process_line(line))
|
||||
text = '\n'.join(new_lines)
|
||||
|
||||
# Restore and convert code blocks
|
||||
for key, value in blocks.items():
|
||||
code = value[1]
|
||||
code = cgi.escape(code)
|
||||
value = r'<pre><code class="language-%s">%s</code></pre>' % (value[0], code)
|
||||
text = text.replace(key, value)
|
||||
|
||||
return text
|
||||
|
||||
|
||||
def process_line(line):
|
||||
line = re.sub(r'#(#+) ', r'\1 ', line) # Increase headings level
|
||||
|
||||
line = re.sub(r'\*\*([^*]+)\*\*', r'__\1__', line) # Escape bold
|
||||
line = re.sub(r'\*([^*]+)\*', r'//\1//', line) # Italic
|
||||
line = re.sub(r'__[^_]__', r'**\1**', line) # Restore bold
|
||||
|
||||
line = re.sub(r'\[([^\]]+)\]\(([^\)]+)\)', r'[[\2 \1]]', line) # Link
|
||||
|
||||
line = re.sub(r'`([^`]+)`', r'\1', line) # Remove inline code blocks
|
||||
|
||||
return line
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Upgrade npm package (dev)dependencies to the latest versions and update package.json
|
||||
#
|
||||
# Require:
|
||||
# - jq - brew install jq
|
||||
|
||||
command -v jq >/dev/null 2>&1 || { echo >&2 "jq not installed: see comments for instructions."; exit 1; }
|
||||
|
||||
# Common stuff
|
||||
RED="$(tput setaf 1)"
|
||||
CYAN="$(tput setaf 6)"
|
||||
UNDERLINE="$(tput sgr 0 1)"
|
||||
NOCOLOR="$(tput sgr0)"
|
||||
function header() { echo -e "$UNDERLINE$CYAN$1$NOCOLOR\n"; }
|
||||
function error() { echo -e "$UNDERLINE$RED$1$NOCOLOR"; }
|
||||
|
||||
if [ ! -f package.json ]; then
|
||||
error "package.json not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
update() {
|
||||
header "Upgrading $1..."
|
||||
for package in $(cat package.json | jq -r ".$1 | keys | .[]" 2>/dev/null); do
|
||||
npm install --$2 $package
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
update dependencies save
|
||||
update devDependencies save-dev
|
||||
|
||||
git diff -U0 package.json
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Human readable password generator.
|
||||
# Based on https://github.com/Version2beta/passphrase
|
||||
|
||||
NAMES_DICT = "/usr/share/dict/propernames"
|
||||
DICT = "/usr/share/dict/words"
|
||||
|
||||
import random
|
||||
|
||||
name = random.sample(list(open(NAMES_DICT)), 1)
|
||||
words = random.sample(list(open(DICT)), 2)
|
||||
phrase = name[0].rstrip().lower()
|
||||
for word in words:
|
||||
phrase = phrase + word.rstrip().lower()
|
||||
print phrase
|
40
bin/showme
40
bin/showme
@ -1,40 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Takes N pictures of you via your iSight camera, animates them, uploads them to CloudApp, and puts the url in your clipboard.
|
||||
#
|
||||
# USAGE: showme [shots]
|
||||
#
|
||||
# Author: Artem Sapegin, sapegin.me
|
||||
# Inspired by https://gist.github.com/832125
|
||||
#
|
||||
# Requirements:
|
||||
# brew istall imagemagick imagesnap
|
||||
# gem install gifme cloudapp_api json
|
||||
# https://github.com/holman/dotfiles/blob/master/bin/cloudapp
|
||||
# http://www.getcloudapp.com/
|
||||
#
|
||||
|
||||
|
||||
# 3 shots by default
|
||||
shots=${1-3}
|
||||
|
||||
TMPDIR=`mktemp -d` && {
|
||||
cd $TMPDIR
|
||||
|
||||
for ((shot=1; shot<=$shots; shot++)); do
|
||||
echo "Prepare for shot $shot..."
|
||||
echo "3..."
|
||||
sleep 1
|
||||
echo "2..."
|
||||
sleep 1
|
||||
echo "1..."
|
||||
sleep 1
|
||||
echo "GO!"
|
||||
imagesnap -q "shot$shot.jpg"
|
||||
done
|
||||
|
||||
gifme -w 200 -o hereisapictureofme.gif *.jpg
|
||||
|
||||
rm -rf $TMPDIR
|
||||
}
|
Reference in New Issue
Block a user