Skip to content

Instantly share code, notes, and snippets.

View zeroflag's full-sized avatar

Attila Magyar zeroflag

  • 🔥
View GitHub Profile
import sys
from random import random
from operator import add
from pyspark.sql import SparkSession
if __name__ == "__main__":
"""
Usage: pi [partitions]
@zeroflag
zeroflag / tone.f
Last active August 26, 2021 21:17
1319 val: e
1047 val: c
1567 val: g
784 val: G
659 val: E
880 val: A
988 val: B
932 val: Bb
1397 val: f
1175 val: d
import socket, threading, sys
class DhtServer(threading.Thread):
def __init__(self, port):
threading.Thread.__init__(self)
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.bind(('0.0.0.0', port))
self.socket.listen(1)
def run(self):
: unit 200 * ;
: ,, 1 unit ms ;
: _ 600 1 unit tone 1 unit ms ;
: ___ 600 3 unit tone 3 unit ms ;
: morse ( s -- )
#[
'A' { _ ,, ___ }
'B' { ___ ,, _ ,, _ ,, _ }
'C' { ___ ,, _ ,, ___ ,, _ }
-> amount => type
#[
1 'food delivery'
2 'groceries'
3 'snacks'
4 'sport'
5 'public transport'
6 'maintenance'
7 'medical'
8 'travel'
declare size int = 100;
declare fac double = 2.0 / 100.0;
create procedure computeRow(y int)
begin
declare Ci double = (y*fac - 1.0);
for x in 0..size-1 loop
declare Zr double = 0.0;
declare Zi double = 0.0;
SELECT count(distinct ws_order_number) as order_count,
sum(ws_ext_ship_cost) as total_shipping_cost,
sum(ws_net_profit) as total_net_profit
FROM web_sales ws1
JOIN customer_address ca ON (ws1.ws_ship_addr_sk = ca.ca_address_sk)
JOIN web_site s ON (ws1.ws_web_site_sk = s.web_site_sk)
JOIN date_dim d ON (ws1.ws_ship_date_sk = d.d_date_sk)
LEFT SEMI JOIN (SELECT ws2.ws_order_number as ws_order_number
FROM web_sales ws2 JOIN web_sales ws3
ON (ws2.ws_order_number = ws3.ws_order_number)
+----------------------------------------------------+
| Explain |
+----------------------------------------------------+
| STAGE DEPENDENCIES: |
| Stage-1 is a root stage |
| Stage-0 depends on stages: Stage-1 |
| |
| STAGE PLANS: |
| Stage: Stage-1 |
| Tez |
+----------------------------------------------------+
| Explain |
+----------------------------------------------------+
| STAGE DEPENDENCIES: |
| Stage-1 is a root stage |
| Stage-0 depends on stages: Stage-1 |
| |
| STAGE PLANS: |
| Stage: Stage-1 |
| Tez |
+----------------------------------------------------+
| Explain |
+----------------------------------------------------+
| STAGE DEPENDENCIES: |
| Stage-1 is a root stage |
| Stage-0 depends on stages: Stage-1 |
| |
| STAGE PLANS: |
| Stage: Stage-1 |
| Tez |