Skip to content

Instantly share code, notes, and snippets.

View blackout314's full-sized avatar
🛸
fly away

Carlo Denaro blackout314

🛸
fly away
View GitHub Profile

Installing Python 3.7.4 on Raspbian

As of July 2018, Raspbian does not yet include the latest Python release, Python 3.7.4. This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).
<?php
//
// download phpMQTT from https://github.com/bluerhinos/phpMQTT
//
error_reporting(0);
require "phpMQTT.php";
$server = "127.0.0.1";
$port = 1883;
$username = "";
@blackout314
blackout314 / made-with-love.html
Created February 11, 2020 16:20 — forked from oliveratgithub/made-with-love.html
Various HTML-snippets to add "Made with love" to your website
<!-- Example #1 - no styling -->
Made with ❤ in Switzerland
<!-- Example #2 - inline-styled ❤ -->
Made with <span style="color: #e25555;">&#9829;</span> in Switzerland
Made with <span style="color: #e25555;">&hearts;</span> in Switzerland
<!-- Example #3 - CSS-style class for ❤ -->
<style>.heart{color:#e25555;}</style>
Made with <span class="heart"></span> in Switzerland
@blackout314
blackout314 / example.sh
Created May 7, 2020 10:26 — forked from tristanbes/example.sh
Install Graphite on Debian Server
# Installing graphite dependencies
apt-get install -y python2.6 python-pip python-cairo python-django python-django-tagging
apt-get install -y libapache2-mod-wsgi python-twisted python-memcache python-pysqlite2 python-simplejson
pip install whisper
pip install carbon
pip install graphite-web
# Setup a vhost by grabbing the example the graphite team released on their repo.
# In this file, you'll provide the url used to access to your Graphite dashboard
wget https://raw.github.com/tmm1/graphite/master/examples/example-graphite-vhost.conf -O /etc/apache2/sites-available/graphite
@blackout314
blackout314 / check mag pi issue
Created November 2, 2020 13:22
check when new magpi issue go out
TGAPI='TELEGRAM_BOT_API'
CHATID='CHAT_ID'
ISSUE=`cat MagPiIssue.txt`
RES=`curl --write-out "%{http_code}\n" --silent --output /dev/null https://magpi.raspberrypi.org/issues/$ISSUE/pdf`
if [ "$RES" -eq 200 ];
then
echo "$((ISSUE+1))" > MagPiIssue.txt
echo $RES
@blackout314
blackout314 / md5.js
Created February 12, 2021 09:21
md5 javascript function php equivalent
function md5(inputString) {
var hc="0123456789abcdef";
function rh(n) {var j,s="";for(j=0;j<=3;j++) s+=hc.charAt((n>>(j*8+4))&0x0F)+hc.charAt((n>>(j*8))&0x0F);return s;}
function ad(x,y) {var l=(x&0xFFFF)+(y&0xFFFF);var m=(x>>16)+(y>>16)+(l>>16);return (m<<16)|(l&0xFFFF);}
function rl(n,c) {return (n<<c)|(n>>>(32-c));}
function cm(q,a,b,x,s,t) {return ad(rl(ad(ad(a,q),ad(x,t)),s),b);}
function ff(a,b,c,d,x,s,t) {return cm((b&c)|((~b)&d),a,b,x,s,t);}
function gg(a,b,c,d,x,s,t) {return cm((b&d)|(c&(~d)),a,b,x,s,t);}
function hh(a,b,c,d,x,s,t) {return cm(b^c^d,a,b,x,s,t);}
function ii(a,b,c,d,x,s,t) {return cm(c^(b|(~d)),a,b,x,s,t);}

restore db

mysql -h host --one-database arnaldoz < db.sql -u root -p

backup db

mysqldump --database arnaldoz mysql > db.sql -u root -p

@blackout314
blackout314 / App.md
Created February 8, 2022 14:28 — forked from kcak11/App.md
Country Codes

Country Codes

List of all Country Codes (ISO & Dialing) sorted in alphabetical order.

@blackout314
blackout314 / mastodon.css
Created May 17, 2022 16:59 — forked from amelandri/notice.md
Mastodon Custom CSS
:root {
--bordercolor: #dadbdb;
--gray: #797979;
--lightgray1: #e3e8ea;
--lightgray2: #edeff0;
--lightyellow: #fff6eb;
--lightblue: #bcdef7;
--blue: #1572b5;
}
@blackout314
blackout314 / __upload_file.md
Last active April 13, 2023 15:05 — forked from maxivak/__upload_file.md
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");