Skip to content

Instantly share code, notes, and snippets.

View zeroflag's full-sized avatar

Attila Magyar zeroflag

View GitHub Profile
import javax.crypto.SecretKey;
import java.io.FileInputStream;
import java.nio.channels.FileChannel;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.security.KeyStore;
public class ShowKey {
public static void main(String[] args) throws Exception {
if (args.length != 3) {
@zeroflag
zeroflag / obj.lisp
Last active November 15, 2023 18:05
;; title: game title
;; author: game developer, email, etc.
;; desc: short description
;; site: website link
;; license: MIT License (change this to your license of choice)
;; version: 0.1
;; script: fennel
(fn player [px py]
(var x px)
: hexchr>n ( chr -- n )
48 over 57 between? if 48 - exit then
65 over 70 between? if 55 - exit then
97 over 102 between? if 87 - exit then
-1 ;
: hexstr>n ( adr len -- n )
0 >r
begin
dup 0 >
ExpensePlot new
x: #key ;
y: #value;
data: ((self firstMonth to: self lastMonth) collect: [:i | i -> (self month: i) sum ]);
plot.
((self firstMonth to: self lastMonth) collect: [:i | (self month: i) totalFood ]) average.
Object>>chain
^ ChainProxy new setTarget: self
ChainProxy>>doesNotUnderstand: aMessage
target := aMessage sendTo: target.
^ target
ChainProxy>>setTarget: anObject
target := anObject.
^ self
@zeroflag
zeroflag / wc.py
Last active November 2, 2021 12:35
import sys
from operator import add
from pyspark.sql import SparkSession
import time
if __name__ == "__main__":
#if len(sys.argv) != 2:
# print("Usage: wordcount <file>", file=sys.stderr)
# sys.exit(-1)
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' { ___ ,, _ ,, ___ ,, _ }