Skip to content

Instantly share code, notes, and snippets.

Djalma Bina djalmabright

Block or report user

Report or block djalmabright

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
@djalmabright
djalmabright / flattenerArray.js
Created Apr 30, 2019
Javascript Console implementation to flatten an array of arbitrarily nested arrays of integers into a flat array of integers.
View flattenerArray.js
'use strict';
// exam if the array is already flattened
// returns true/false
const isArrayFlattened = function($array) {
if (!$array) {
return true;
}
for (const item of $array) {
if (item instanceof Array) {
@djalmabright
djalmabright / client.cpp
Created Nov 27, 2018 — forked from Tryptich/client.cpp
Multiple streaming in c++ using opencv; OpenCV video streaming over TCP/IP
View client.cpp
/**
* OpenCV video streaming over TCP/IP
* Client: Receives video from server and display it
* by Steve Tuenkam
*/
#include "opencv2/opencv.hpp"
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
@djalmabright
djalmabright / capture.py
Created Apr 9, 2018 — forked from thearn/capture.py
Screen capture using python PIL
View capture.py
import time
import Image
import ImageGrab
while True:
time.sleep(0.5)
t = str(time.time()).replace('.','-')
tt = time.time()
img=ImageGrab.grab()
img = img.resize((800,600))
@djalmabright
djalmabright / django_admin_mpld3_view.py
Created Mar 28, 2018 — forked from leriomaggio/django_admin_mpld3_view.py
Interactive Matplotlib (Bar) Chart with mpld3 in Django Custom Admin View
View django_admin_mpld3_view.py
#----------------------------------------------------------------------------------------
# model.py
#----------------------------------------------------------------------------------------
from django.db import models
from numpy.random import random_sample
class CustomModel(models.Model):
# Put your fields here
def get_data(self):
@djalmabright
djalmabright / pycon-views.py
Created Mar 24, 2018 — forked from miguelgrinberg/pycon-views.py
Generate statistics about PyCon 2014 videos
View pycon-views.py
import argparse
import re
from multiprocessing.pool import ThreadPool as Pool
import requests
import bs4
root_url = 'http://pyvideo.org'
index_url = root_url + '/category/50/pycon-us-2014'
View fermat.sol
pragma solidity ^0.4.18;
/**
* A contract that pays off, if a user is able to produce a valid solution
* for the Fermat's last theorem
*/
contract Fermat {
/**
View snakecoin-node-txion-submit.py
from flask import Flask
from flask import request
node = Flask(__name__)
# Store the transactions that
# this node has in a list
this_nodes_transactions = []
@node.route('/txion', methods=['POST'])
def transaction():
@djalmabright
djalmabright / snakecoin-server-full-code.py
Created Feb 4, 2018 — forked from aunyks/snakecoin-server-full-code.py
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
View snakecoin-server-full-code.py
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:
View snakecoin.py
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
View coindata.php
<?php
/**
* Coin Dashboard by Christian Haschek
* https://blog.haschek.at
*
* Donations always welcome
* BTC: 1ChrisHMgr4DvEVXzAv1vamkviZNLPS7yx
* ETH: 0x1337C2F18e54d72d696005d030B8eF168a4C0d95
*
* Read more at
You can’t perform that action at this time.