Given a sum, break it into n random numbers. (sum, n) => [x1, x2, ... xn] // so that: // x1 + x2 + ... + xn = sum // x1 > x2 > ... > xn > 0
Так, что слагаемые одно больше другого (без равных).
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
class TensorController extends Controller | |
{ | |
/** | |
* Create a new controller instance. |
Sample config files to demonstrate seup that creates and updates free SSL certificates from Let's Encrypt given that the domains are maintained at CloudFlare service.
Certbot verifies domains ownership by accessing CloudFlare API that adds temporary TXT DNS records. To enable it You must provide your CloudFlare API token. More details in documentation for dns-cloudflare Certbot plugin.
Certbot saves created certificates in Docker volume certbot_etc
. Pay attention to output of the certbot run - it mentions path to the created certificates.
По мотивам https://vk.com/id232967147 / https://vk.com/mgnoveniag
cur.filterSaveOptions.upload_url
./** | |
* Parses SMS message text from Yandex.Money | |
* extracts three numbers: | |
* confirmation code, transaction amount and account number. | |
* | |
* @param string $text message text | |
* | |
* @throws Exception on parse failure | |
* | |
* @return array |
((w) => { | |
function superpooper(secret) { | |
const pass = encodeURIComponent(secret); | |
return function onHashChange(){ | |
var hash = w.location.hash.replace(/^#/,""); | |
if (!hash.length) return; | |
const xor = s => s.split('').map((c,i)=>String.fromCharCode(c.charCodeAt(0)^pass.charCodeAt(i%pass.length))).join(''); | |
(() => { | |
const B = '+7 901 555-55-55, +7 903 777-77-77' | |
.split(', ').sort(); | |
const A = '+7 901 555-55-55, +7 926 222-22-22' | |
.split(', ').sort(); | |
const both = [], onlyA = [], onlyB = [], lA = A.length, lB = B.length; | |
#!/bin/bash | |
############################################ | |
# | |
# Compile ffmpeg and ffprobe for AWS Lambda | |
# | |
# Run this on a fresh AWS EC2 instance | |
# running same AMI as AWS Lambda: | |
# https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html | |
# AMI: amzn-ami-hvm-2017.03.1.20170812-x86_64-gp2 |
/** | |
* returns date-time of the nearest week end | |
* as a string "YYYY/MM/DD HH:ii:ss" | |
*/ | |
function getEndOfWeek() { | |
const D = new Date(); | |
D.setDate(D.getDate() - D.getDay() + (D.getDay() ? 7 : 0)); | |
D.setHours(23, 59 - D.getTimezoneOffset(), 59, 0); | |
return D.toISOString().slice(0, 19).replace('T', ' ').replace(/-/g,'/'); | |
} |
AmCharts.loadFile( "data.csv", {}, function( response ) { | |
/** | |
* Parse CSV | |
*/ | |
var data = AmCharts.parseCSV( response, { | |
"useColumnNames": true | |
} ); | |