Skip to content

Instantly share code, notes, and snippets.

Thomas Pigarelli shoooe

  • Italy
Block or report user

Report or block shoooe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am shoooe on github.
  • I am tpigarelli (https://keybase.io/tpigarelli) on keybase.
  • I have a public key ASCbdD34wOQtajdGmowxTw6Vce6Ce5CKBsPf926SpZ0tMwo

To claim this, I am signing this object:

View InstantType.cs
using System;
using GraphQL.Language.AST;
using GraphQL.Types;
using NodaTime;
using NodaTime.Text;
namespace Server.Types
{
public class InstantType : ScalarGraphType
{
View rb_tree.cpp
#include <iostream>
#include <memory>
#include <cassert>
enum class node_color {
red,
black
};
template<typename DataType>
@shoooe
shoooe / .cpp
Last active Dec 30, 2015
All numbers in N bits which are represented by a single 0 in it's binary form.
View .cpp
#include <iostream>
#include <bitset>
int main() {
for (std::bitset<10> zero(1); zero != 0; zero <<= 1)
std::cout << ~zero << '\n';
}
View consume.py
# This function will try to consume the first
# element of the collection using fn: if fn throws, then
# the element was not consumed and the collection is rotated
# so that the non consumed element is at the end of the collection
# and the second one is now at the beginning;
# if fn doesn't throw then the element is removed from the collection
# and the same algorithm is applied to the second (now first) element.
def consume(collection, fn):
while collection:
try:
View gist:c48124b5431cdda5aab4
[ { id: '46642', val: 10898, name: 'r-martinho-fernandes' },
{ id: '16102', val: 9558, name: 'cat-plus-plus' },
{ id: '298661', val: 4516, name: 'puppy' },
{ id: '174614', val: 4261, name: 'tony-the-lion' },
{ id: '85371', val: 4167, name: 'sehe' },
{ id: '252000', val: 4069, name: 'fredoverflow' },
{ id: '1804599', val: 4018, name: 'elyse' },
{ id: '71141', val: 3657, name: 'etienne-de-martel' },
{ id: '500104', val: 3544, name: 'xeo' },
{ id: '140719', val: 3508, name: 'sbi' },
View image_codomain.md

###Why is the codomain useful?

In set theory we have that a domain is the set of all inputs for which a function is defined and the image is the set of possible outputs given those inputs. You would think this would be enough, but no: we also have the concept of codomain, which is the set of all possible outputs and some.

This also leads to the distinction between "surjective" functions and non-"surjective" functions (functions that have the image being equal to the codomain and those that don't, respectively). This distinction seems to provide no useful information about the function itself.

Now, let's make an example, we have:

ƒ : {a, b, c, d} -> {1, 2, 3, 4}
ƒ a = 1
@shoooe
shoooe / avoid.md
Last active Aug 29, 2015
Statements and words to avoid submitting as is while discussing with someone, because they add nothing of value. For instance, nobody cares that you are laughing. HTH
View avoid.md
  • lol
  • lel
  • kek
  • top kek
  • rotfl
  • lmao
  • yeah, no
  • no.
  • what
  • wat
View factorio_basic_rules.md

###Factorio basic rules

  1. Don't be a dick
  • a. The player that hosts has to retrieve the most recent save
  • b. The player that originally hosted has to replace the old save with the new one at the end of the match
  • c. The player whose responsibility is to replace the old save can delegate the job to someone else upon agreement
  1. Destroying property requires consent to those that put it down
  2. Don't kill other players
  3. Autosave period must be set to 15 minutes
View driving_slots.sql
create view total_driving_slots as (
select week_day,
time,
count(id) as total_count
from driving_slots
group by week_day, time
);
create view free_driving_slots as (
select week_day,
You can’t perform that action at this time.