Skip to content

Instantly share code, notes, and snippets.

#include<SmartMatrix.h>
#include<FastLED.h>
#define kMatrixWidth 32
#define kMatrixHeight 32
byte CentreX = (kMatrixWidth / 2) - 1;
byte CentreY = (kMatrixHeight / 2) - 1;
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
@coghen
coghen / transfer.sh
Created December 21, 2014 00:37
vnstat simple script
#!/bin/sh
# skrypt wyciąga najważniejsze dane (tj. transfer w obecnym dniu oraz miesiącu)
# z vnstat i prezentuje je w przystępnej formie.
#
INTERFACES=${@:-eth0}
for IFACE in $INTERFACES; do
vnstat -i "$IFACE" --oneline | awk -v MONTH=$(date +%B) -F';' '{print "Transfery na interfejsie: "$2"\n\n - dzisiaj: "$6" (ściągnięto: "$4" / wysłano: "$5")\n - "MONTH": "$11" (ściągnięto: "$9" / wysłano: "$10")\n"}'
done
<?php
//
// by coGhen (14.06.2013)
//
$zajete=shell_exec('du -h -s /home/coghen |cut -c 1-5');
$wolne=shell_exec('df -h |grep home |cut -c 35-40');
echo("Zajete miejsce: ");
@coghen
coghen / detektor.php
Last active August 29, 2015 14:11
detect your ip address
<?php
function detect_city($ip)
{
$default = 'Lokacja nieznana';
$url = 'http://67.212.77.11/ip_locator.php?ip=' . urlencode($ip);
$content = file_get_contents($url);
if (preg_match('{<li>City : ([^<]*)</li>}i', $content, $regs))
{
#!/bin/bash
# +--------------------------------------+
# | megabekap v1.0 (coghen@12.07.2013) |
# | wymaga pakietu Megatools do pobrania |
# | z http://megatools.megous.com/ |
# +--------------------------------------+
# konto mega.co.nz
megauser=user@gmail.com # mega.co.nz login
megapass='a<.bc#@*gRD' # mega.co.nz password
#!/bin/sh
##############################################################################
# skrypt do aktualizacji dynamicznych domen na http://freedns.afraid.org
# uruchamiac z cron'a co jakis czas np. co 30 minut:
# */30 * * * * $HOME/afraider > /dev/null 2>&1
#
# by coghen@gmail.com [06-09-2009]
###############################################################################
katalog=$(pwd)
@coghen
coghen / pogoda.sh
Last active August 29, 2015 14:11
weather in Zagan
#!/bin/sh
#
# aktualna pogoda w Zaganiu
# coGhen(2o13.o7.19)
#
curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=1\&locCode\=EUR\|PL\|PL005\|ZAGAN | sed -n '/Currently:/ s/.*: \(.*\):
\([0-9]*\)\([CF]\).*/\2 °\3, \1/p'