Skip to content

Instantly share code, notes, and snippets.

from channels.generic.websocket import WebsocketConsumer, AsyncConsumer
import json
from random import randint
from time import sleep
import asyncio
class WSConsumer(AsyncConsumer):
async def websocket_connect(self, _):
await self.send({
class SistemaTriangularInferior
def initialize(matrix, result)
@x = []
@matrix = matrix
@result = result
@summation = []
@lock_summation = false
@lock_calculation = true
end
class CustomThread
attr_accessor :after_iteration
def initialize(mutex, iterations, name, operation, a, b, locked = true)
@mutex = mutex
@locked = locked
@thread = Thread.new do
result = a.send(operation, b)
secs = rand(1..10)
@giancarlopro
giancarlopro / threads.rb
Created June 17, 2021 17:51
Trabalho de threads #2
def input(msg)
puts msg
gets.chomp.to_i
end
def create_thread(a, b, operation, name)
Thread.new do
result = a.send(operation, b)
secs = rand(1..20)
@giancarlopro
giancarlopro / request.md
Created June 15, 2021 14:27
pesquisa de customer

Request

GET /rest/default/V1/customers/search?searchCriteria[currentPage]=1&searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[filterGroups][0][filters][0][field]=taxvat&searchCriteria[filterGroups][0][filters][0][value]=64382763673
Authorization: Bearer <token>

Parametros

['Programação Paralela', 'Instituto Federal Fluminense']
.map { |message| Thread.new { puts message } }
.each(&:join)
POST {{url}}/PessoaRest/api/Pessoa/InserirPessoa/:token

{
  "payload": {
    "cod_pessoa": 0,
    "cod_usuario": 0,
    "cod_classif_pessoa": 0,
    "nom_pessoa": "Giancarlo da Silva Rocha",
    "cod_cpf": "17465108740",
@giancarlopro
giancarlopro / vote.py
Created July 12, 2020 14:02
Votação no pollie.app
import requests
from concurrent.futures import ThreadPoolExecutor, as_completed
def votar(i, **kwargs):
s = requests.Session()
s.headers.update(
{
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
'origin': 'https://pollie.app',
}
@giancarlopro
giancarlopro / rotacao.js
Created February 18, 2020 02:09
I'VE CRACKED THE MOTHERFUCKING CODE
<img id="myImg" src="https://s1.static.brasilescola.uol.com.br/be/e/Untitled-6(40).jpg" />
<style>
img {
overflow: hidden;
transition-duration: 0.8s;
transition-property: transform;
}
</style>
///+------------------------------------------------------------------+
//| ITSA_ITUB.mq5 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
int magicNumber = 1;