Given an apt-offline.sig file, launch an AWS EC2 instance to download the corresponding packages and upload the resulting bundle to the configured S3 bucket:
$ download-apt-packages apt-offline.sig
| #! /bin/bash | |
| if (( $# )) | |
| then | |
| echo "usage: mkfifo r.fifo ; nc -q 1 localhost 6379 < r.fifo | $0 > r.fifo" >&2 | |
| exit 2 | |
| fi | |
| KEY="test-key" | |
| VAL="val" |
| /* | |
| This program demonstrates a bug with eventmachine on OSX. When /etc/hosts is | |
| set like this: | |
| 127.0.0.1 localhost | |
| 255.255.255.255 broadcasthost | |
| ::1 localhost | |
| the program will fail with a ECONNREFUSED (61) error when localhost is used | |
| to resolve the local interface address. The program shows that in such |
| default-cache-ttl 36000 | |
| max-cache-ttl 86400 |
| import monotonic | |
| from time import clock as cpu_time | |
| import cProfile, pstats | |
| try: | |
| from StringIO import StringIO | |
| except ImportError: | |
| from io import StringIO | |
| def time_it(label): | |
| start_total = monotonic.monotonic() |
| function GOOGLEPCHANGE() { | |
| var prices = arguments[0]; | |
| var result = []; | |
| if (prices.length < 3) { | |
| throw "Price array should have at least rows"; | |
| } | |
| for (var i = 1; i < arguments.length; i++) { | |
| result.push(findPriceChange_(prices, arguments[i])); |
$ createdb mydb
$ sudo -u postgres psql mydb
# CREATE ROLE myrole WITH LOGIN PASSWORD 'mypwd';
# GRANT CONNECT ON DATABASE mydb TO myrole;
# GRANT USAGE ON SCHEMA public TO myrole;
# GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO myrole;
# GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO myrole;
| #! /usr/bin/perl | |
| use strict; | |
| use warnings; | |
| use LWP::UserAgent (); | |
| use HTML::TreeBuilder::XPath; | |
| my $url = "https://br.advfn.com/bolsa-de-valores/bovespa/"; | |
| my $ua = LWP::UserAgent->new; |
| ! folha.uol.com.br | |
| ||paywall.folha.uol.com.br^ | |
| ^disablecopy.js| | |
| ! estadao.com.br | |
| ||acesso.estadao.com.br^ | |
| ! abril.com.br | |
| ||cdn.tinypass.com^ | |
| ! oglobo.globo.com | |
| .glbimg.com/*/_js/paywall/* | |
| ||id.globo.com^ |
| import datetime | |
| def parse_datetime(s): | |
| """Parse a datetime string with minimal validations. | |
| `parse_datetime` takes a string with format yyyy-mm-dd HH:MM:SS.zzzzzz | |
| and returns a `datetime.datetime` object. Any prefix of that format is | |
| accepted as well; so a string like "2017-12-22" will return a datetime | |
| with hour, mins, secs and microsecs set to zero. |