Skip to content

Instantly share code, notes, and snippets.

View sentenza's full-sized avatar

Alfredo Torre sentenza

View GitHub Profile
@sentenza
sentenza / cryptos.md
Last active March 21, 2021 00:57
Cryptocurrencies and BlockChain useful resources

Bitcoin

On October 31st 2008, the programmer/programmers known as Satoshi Nakamoto published this paper through a metzdowd.com cryptography mailing list that describes the Bitcoin currency and solves the problem of double spending so as to prevent the currency from being copied.

In January of 2009, he started mining, creating what is known as the “genesis block.” Bitcoin v0.1 was released six days later. By year-end, over 32,000 blocks had been added to this original block, producing a total of 1,624,250 bitcoins. Since all transactions are public on the blockchain, we know that only a quarter of those bitcoins have ever changed hands, leading some to speculate that Satoshi could be sitting on a stash of roughly one million bitcoins, worth ~$120 million at today’s exchange rate. Who is Satoshi Nakamoto

Papers

@sentenza
sentenza / Chunked.md
Last active July 17, 2017 21:35
PHP and ionic file upload

Transfer-encoding: chunked

When the server needs to send large amount of data, chunked encoding is used by the server because it did not exactly know how big (length) the data is going to be. In HTTP terms, when server sends response Content-Length header is omitted by the server. Instead server writes the length of current chunk in hexadecimal format followed by \r\n and then chunk, followed by \r\n (Content begins with chunk size in hex followed by chunk)

This feature can be used for progressive rendering; however the server needs to flush the data as much as possible so that client can render content progressively (in case of html,css etc)

This feature is often used when server pushes data to the client in large amounts - usually in giga bytes.

Source: https://stackoverflow.com/a/45086785/1977778

@sentenza
sentenza / scala-2.11-8_sbt-13.15.sh
Last active August 30, 2018 02:15 — forked from nmfzone/gist:2dc02fb73f30c47faf39005bd21d6331
Install Scala 2.12.2 and sbt 0.13.15 - Ubuntu 16.10 Yakkety
# Scala Installation
wget https://downloads.lightbend.com/scala/2.12.2/scala-2.12.2.deb
sudo dpkg -i scala-2.12.2.deb
# sbt Installation
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
@sentenza
sentenza / sequence-increment.scala
Created February 26, 2017 00:24
A recursive way to increment a sequence of Integers - which are in fact Digits [0 ... 9].
/** Given a Sequence of Integers Seq(2, 3, 4) - which represents the number 234 base 10 - increments
* by one without converting types.
*
* @param s Seq[Int] The original sequence representation of the number
* @return The incremented by one Sequence
*/
def sequenceIncrement(s: Seq[Int]): Seq[Int] = {
sequenceIncrementRec(s.reverse, Seq.empty, carry = true).reverse
}
#Module dependencies
# mod_rewrite
# mod_ssl
# This section is only needed if you want to redirect http traffic to https.
# You can live without it but clients will have to type in https:// to reach gitlab.
<VirtualHost *:80>
ServerName domain.com
ServerSignature Off
@sentenza
sentenza / networkmanager-wifi-powersave.md
Created January 22, 2017 10:01 — forked from jcberthon/networkmanager-wifi-powersave.md
NetworkManager Wi-Fi powersaving configuration

NetworkManager WiFi Power Saving

NetworkManager supports WiFi powersaving but the function is rather undocumented.

From the source code: wifi.powersave can have the following value:

  • NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0): use the default value
  • NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1): don't touch existing setting
  • NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2): disable powersave
@sentenza
sentenza / symfony3_upgrade.md
Last active January 23, 2017 15:13
How to upgrade from Symfony2 to Symfony3

Before updating to Symfony 3

General fixes

You need to launch this Symfony2 version fixer.

Security context fix

Then you have to change every occurrency of security.context with security.token_storage (see also this SO answer http://stackoverflow.com/a/29672308/1977778). You must update your codebase to match the security component improvements of version 2.6, as described here.

@sentenza
sentenza / symfony_doctrine_merge.md
Last active June 28, 2020 14:07
How to deal with Symfony and doctrine merge

You should use merge operation on entities which are in detached state and you want to put them to managed state.

Merging should be done like this $entity = $em->merge($detachedEntity). After that $entity refers to the fully managed copy returned by the merge operation. Therefore if your $form contains detached entities, you should adjust your code like this:

$doctrineManager = $this->getDoctrine()->getManager();
foreach ($form->getData()->getEntities() as $detachedEntity) {
    $entity = $doctrineManager->merge($detachedEntity);  
    $doctrineManager->remove($entity);
}

$doctrineManager->flush();

@sentenza
sentenza / KeyConcepts.md
Created December 7, 2016 08:12
Progressive Web Apps (PWA)

What's a Progressive Web App?

  • Obviously, no install required
  • It loads quickly, even on flaky networks
  • Can send push notifications
  • May have an icon on the home screen (loading as a top-level)
  • Should support full-screen mode

Key features

@sentenza
sentenza / StartWithReactJS.md
Last active October 26, 2016 14:51
All the information that really matters to learn and user ReactJS at glance

React logo

Fundamental concepts

  • JSX: Allows us to write HTML like syntax which gets transpiled to lightweight JavaScript objects, thus being much more concise than pure old JS
  • Virtual DOM: A JavaScript representation of the actual DOM
  • React.createClass(): The way in which you create a new component
  • render(): Each component has to have this method in order to be rendered
  • ReactDOM.render: Renders a React component to a DOM node.
  • state: The internal data store (object) of a component. Each component has the ability to manage its own state and pass its state down to child components if needed.