Skip to content

Instantly share code, notes, and snippets.

View thiagodelgado111's full-sized avatar

Thiago Delgado thiagodelgado111

View GitHub Profile
@thiagodelgado111
thiagodelgado111 / flask
Last active August 17, 2017 17:33
flask hello world
#!/bin/python
from flask import Flask, render_template, jsonify, send_from_directory, request
app = Flask("MY_GR8_APP", static_folder='static', static_url_path='')
app.debug = True
@app.route("/hello/")
def richie():
return "It's me you're looking for..."
var bencode = new Bencode();
bencode.Encoding.Encode(1); //"i1e"
bencode.Encoding.Encode([1,2,3, {"Test" : 123} ]); //"li1ei2ei3ed4:Testi123eee"
bencode.Encoding.Encode("Test"); //"4:Test"
bencode.Encoding.Encode(-1), //"i-1e"
bencode.Encoding.Encode(0); //"i0e"
bencode.Encoding.Encode(01); //"i1e" `
bencode.Decoding.Decode("i10e"); //10
var dcrypt = function(a){
var letters = "acdegilmnoprstuw";
var str = "";
var dcrypted = false;
while(!dcrypted){
for(var i = 0; i < letters.length; i++)
{
@thiagodelgado111
thiagodelgado111 / CustomServer.js
Last active September 29, 2015 15:21
Custom server TCP
/*jslint node: true */
var net = require('net');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var _ = require('lodash');
var S = require('string');
var traceback = require('traceback');
var dateFormat = require('date-format');
var os = require("os");
@thiagodelgado111
thiagodelgado111 / custom_server_start.js
Created September 29, 2015 15:14
Starting TCP socket server
var client = new CustomServer(CONFIG_PARAMETERS);
client.createConnection();
client.open();
client.on('serverCreated', function(socket) {
if (!!client.socket) {
if (FIXTURES.Nodes.length > 0) {
@thiagodelgado111
thiagodelgado111 / mantras
Last active February 20, 2016 15:06 — forked from IngmarBoddington/mantras
Coding Mantras
* Don't Repeat Yourself - DRY
- Don't repeat code
- Use reusability
* Keep It Simple Stupid - KISS
- Don't overcomplicate for it's own sake
* Don't make me think.
* Program to an interface.
* Composisition over inheritance.
@thiagodelgado111
thiagodelgado111 / complexity_test.js
Last active November 25, 2016 15:24
eslint complexity rule question
const a = true;
const b = false;
const c = true;
if (a && b && c) {
throw new Error('zomg!');
}
if (a || b || c) {
pragma solidity ^0.4.15;
contract Example {
address public owner;
function Example () {
owner = msg.sender;
}
@thiagodelgado111
thiagodelgado111 / StoreBuilder.js
Created September 4, 2018 17:17
StoreBuilder
class StoreBuilder {
constructor(StoreClass, ipfs, peerId, address) {
if (!StoreClass) throw new Error('Store class to build not defined')
if (!ipfs) throw new Error('IPFS is required')
if (!peerId) throw new Error('peerId is required')
if (!address) throw new Error('Store address is required')
this.StoreClass = StoreClass
this.ipfs = ipfs
@thiagodelgado111
thiagodelgado111 / intro.md
Created April 5, 2020 03:30 — forked from derhuerst/intro.md
Installing Git on Linux, Mac OS X and Windows