Simple POC
brew install wget
gcc -lcurl download_internet.c
backup-repos() { | |
for i in $(find . -type d -maxdepth 1 -mindepth 1); do | |
echo "Looking in $i..." | |
if [ -d "$i/.git" ]; then | |
echo "Found repository in $i, init backup..." | |
pushd $i > /dev/null | |
zip_name="$i-$(date +'%y%m%d').zip" | |
zip_path="/opt/backups/$zip_name" | |
echo "ZIP path: $zip_path" | |
if [ ! -f "$zip_path" ]; then |
const digit_to_string = { | |
0: 'zero', | |
1: 'one', | |
2: 'two', | |
3: 'three', | |
4: 'four', | |
5: 'five', | |
6: 'six', | |
7: 'seven', | |
8: 'eight', |
<?php | |
function autoIncrement($start = 0, $step = 1, $circle = -1, $repeat = 1) { | |
$i = $start; | |
while (true) { | |
for ($j = 0; $j < $repeat; $j++) yield $i; | |
$i += $step; | |
if ($i === $circle) $i = $start; | |
} | |
} |
FROM php:7.1-fpm | |
RUN set -ex && \ | |
apt-get update && \ | |
apt-get -y --no-install-recommends install \ | |
apt-utils \ | |
unzip \ | |
nano \ | |
git |
const aws = require('aws-sdk'); | |
aws.config.loadFromPath('aws.json'); | |
const locale = 'it-IT'; | |
const fs = require('fs'); | |
const pollyClient = new aws.Polly({ | |
signatureVersion: 'v4', | |
region: 'eu-west-1' |
<?php | |
namespace App\Libraries\OAuth; | |
class ImplicitGrantWithPostmessage extends \League\OAuth2\Server\Grant\ImplicitGrant | |
{ | |
public function completeAuthorizationRequest(\League\OAuth2\Server\RequestTypes\AuthorizationRequest $authorizationRequest) { | |
$response = parent::completeAuthorizationRequest($authorizationRequest); | |
$reflectionClassResponse = new \ReflectionClass($response); |
#!/bin/sh | |
while (true); do | |
inotifywait . -m -r -e create -e modify -e move -e delete | |
./execute-command.sh | |
done |
const Client = require('castv2-client').Client; | |
const Spotify = require('./Spotify'); | |
const mdns = require('mdns'); | |
const browser = mdns.createBrowser(mdns.tcp('googlecast')); | |
browser.on('serviceUp', function(service) { | |
console.log('found device "%s" at %s:%d', service.txtRecord.fn, service.addresses[0], service.port); | |
if (service.txtRecord.fn === process.env.SPOTFIY_DEVICE) { | |
ondeviceup(service.addresses[0], service.txtRecord.fn); |