Skip to content

Instantly share code, notes, and snippets.

View magnum's full-sized avatar
💭
experimenting...

Antonio Molinari magnum

💭
experimenting...
View GitHub Profile
@dhh
dhh / linux-setup.sh
Last active July 24, 2024 13:05
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
@danielabrozzoni
danielabrozzoni / spiegazione.md
Last active January 18, 2024 23:14
Spendere Bitcoin dal terminale usando bitcoin-cli

Spendere Bitcoin dal terminale usando bitcoin-cli

In questo (si spera corto) tutorial proveremo a spendere alcuni Bitcoin utilizzando bitcoin-cli.

In questo tutorial uso la rete signet, ma ovviamente gli stessi passaggi funzionano anche per mainnet, testnet, e regtest.

Prerequisiti:

  • bitcoind avviato e syncato
  • Avere alcuni sats da spendere con bitcoin-cli (potete ottenerli con un faucet se siete su signet/testnet, o minando su regtest)
@magnum
magnum / dotenv.php
Created December 16, 2022 15:01
dotenv support in php, eg. wordpress
<?php
try {
require_once 'vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createUnsafeImmutable('./');
$dotenv->load();
} catch (Exception $e) {
echo(implode("<br>", array(
("Caught exception: ".$e->getMessage()."<br>"),
"please be sure to install .env support package with 'composer require vlucas/phpdotenv'",
"and that a .env is present"
@magnum
magnum / blockchain_attributes.json
Last active January 13, 2022 11:09
mylime - colnago asset attributes
{
"method": "create",
"id": "unique_identifier",
"tag_serial_number" : "04:C1:D6:C2:58:66:80",
"name": "asset name",
"user_id": 123,
"No.": {
"attributeCode": "ART.000026331",
"attributeDescription": "ART.000026331"
},
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
setTimeout(function(){
jQuery.noConflict();
//code
}, 2000);
<?php
if (file_exists(dirname(__FILE__) . '/wp-config-local.php')):
require_once(dirname(__FILE__) . '/wp-config-local.php');
return;
endif;
define( 'WP_HOME', 'http://example.com/' );
define( 'WP_SITEURL', 'http://example.com/' );
// ...
@magnum
magnum / functions.php
Last active January 27, 2020 17:43
wordpress utils
function dbg_print_script($script,$alert=FALSE){
if($alert) echo('<script>alert("'.$script.'");</script>');
echo("<script>$script</script>");
}
function dbg($what){
echo("<pre>".print_r($what, true)."</pre>");
}
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active July 22, 2024 09:05
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

function getUpdates() {
updateCell("B3", "ripple")
updateCell("C3", "bitcoin")
updateCell("D3", "ethereum")
updateCell("E4", "litecoin")
updateCell("F4", "iota")
}
function updateCell(cell, code) {
const response = UrlFetchApp.fetch("https://api.coinmarketcap.com/v1/ticker/" + code + "/?convert=EUR")
@gangsta
gangsta / SSL.md
Last active February 23, 2024 03:56
How to Setting Up a Comodo SSL Cert

How to Setting Up a Comodo SSL Cert

  • I advice you to buy SSL Certs from officially Comodo only , or some SSL reseller whose you trust.

These are the steps I went through to set up an SSL cert. Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You’ll be asked for the content of the CSR file when ordering the certificate:

openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr