Skip to content

Instantly share code, notes, and snippets.

View Mika-'s full-sized avatar

Mika Simanainen Mika-

View GitHub Profile
@Mika-
Mika- / favicon.bat
Created June 17, 2015 18:07
Create a multi resolution favicon with imagemagick
convert logo.png -background transparent -resize 64x64 -gravity center -extent 64x64 ^
( -clone 0 -resize 48x48 ) ^
( -clone 0 -resize 32x32 ) ^
( -clone 0 -resize 16x16 ) ^
-colors 256 -alpha background favicon.ico
curl -s "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=dnsmasq&showintro=0&mimetype=plaintext" | sed "s/127\.0\.0\.1/0.0.0.0/" > /etc/dnsmasq.d/dnsmasq.adlist.conf
/etc/init.d/dnsmasq force-reload
@Mika-
Mika- / google-analytics.amp.html
Created October 18, 2015 10:34
Use Google Analytics in AMP HTML
<amp-pixel src="https://ssl.google-analytics.com/collect?v=1&amp;tid=UA-12345678-1&amp;t=pageview&amp;cid=$RANDOM&amp;dt=$TITLE&amp;dl=$CANONICAL_URL&amp;z=$RANDOM"></amp-pixel>
/*
* Required parameters:
* v = API version number (currently 1)
* tid = Google Analytics property identifier (UA-12345678-1)
* t = hit type
* cid = client id (you should implement this via cookie etc.)
* z = random string to bypass caching (amphtml generates this to $RANDOM variable)
@Mika-
Mika- / gist:185c8d777aab3ebba548
Created February 11, 2015 15:26
Resize and convert image to web optimized jpg with imagemagick and mozjpeg
convert source.png -resize 1920x1080 -background white -flatten TGA:- | cjpeg -quality 90 -targa -outfile compressed.jpg
C:\WINDOWS\system32> dism /online /get-capabilities | findstr /i "OpenSSH"
Capability Identity : OpenSSH.Client~~~~0.0.1.0
Capability Identity : OpenSSH.Server~~~~0.0.1.0
C:\WINDOWS\system32>dism /online /Add-Capability /CapabilityName:OpenSSH.Client~~~~0.0.1.0
Deployment Image Servicing and Management tool
Version: 10.0.16299.15
Image Version: 10.0.16299.64
<?php
/**
* Sort array of string by relevance
*
* @param array $array
* @param string $query
* @return array
*/
function array_sort_suggest(array $array, string $query) : array
<?php
/**
* Get first element from array
*
* @param array $array
* @return mixed|null
*/
function array_first(array $array)
{
<?php
declare(strict_types=1);
namespace App;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;

Storj.io node diary

2020-12-01

November resulted pretty similar figures. Total size of data on the nodes is now 1.8TB and the final bandwidth for the month was 794GB ingress and 58GB egress

2020-11-01

During last month my node grew to 992GB. This was the first vetted month so traffic should finally be at a normal level. This resulted as 780GB ingress and 51GB egress. Added a second node on another hard drive with 500GB limit.

2020-09-26

Node is about one month old and is using 250GB of storage. Vetting process is completed on 3/5 satellites. Last two are sitting at 63 and 84 audits. Bandwidth has finally picked up a little, but that may be related to network distruption going on.

<?php
/**
* Find first element from array by callback
*
* @param array|\Traversable $array
* @param callable $callback
* @return mixed|null
*/
function array_find($array, callable $callback)