Skip to content

Instantly share code, notes, and snippets.

View beetleman's full-sized avatar
🐐
💕

Mateusz Probachta-Jeżowski beetleman

🐐
💕
  • Cracow
  • 20:42 (UTC -12:00)
View GitHub Profile
@beetleman
beetleman / clojure-deftype-scaffolding.clj
Created September 16, 2020 15:14 — forked from semperos/clojure-deftype-scaffolding.clj
Clojure Scaffolding for deftype (Christophe Grand) - Show which methods a class implements and for which interfaces
;; Big thanks to Christophe Grand - https://groups.google.com/d/msg/clojure/L1GiqSyQVVg/m-WJogaqU8sJ
(defn scaffold [iface]
(doseq [[iface methods] (->> iface .getMethods
(map #(vector (.getName (.getDeclaringClass %))
(symbol (.getName %))
(count (.getParameterTypes %))))
(group-by first))]
(println (str " " iface))
(doseq [[_ name argcount] methods]
(println
@beetleman
beetleman / byte_range.file.clj
Created March 25, 2020 21:23 — forked from tawus/byte_range.file.clj
byte range aware file-response for ring
(ns byte-range.file
(:require [ring.util.response :as ring-resp :refer
[header status get-header content-type]]
[ring.util.time :refer [parse-date format-date]]
[ring.util.request :as request]
[ring.util.codec :as codec]
[pantomime.mime :refer [mime-type-of]]
[clojure.string :as str]
[clojure.java.io :as io])
(:import [java.io RandomAccessFile]
@beetleman
beetleman / proc.clj
Created March 17, 2020 19:34 — forked from codification/proc.clj
Clojure asynchronous process
(ns proc
(:import [java.lang ProcessBuilder])
(:use [clojure.java.io :only [reader writer]]))
(defn spawn [& args]
(let [process (-> (ProcessBuilder. args)
(.start))]
{:out (-> process
(.getInputStream)
(reader))
@beetleman
beetleman / remove-all-from-docker.sh
Created February 27, 2018 09:16 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
Solidity lets you program on Ethereum, a blockchain-based virtual machine that allows the creation and execution of smart contracts, without needing centralized or trusted parties.
Solidity is a statically typed, contract programming language that has similarities to Javascript and C. Like objects in OOP, each contract contains state variables, functions, and common data types. Contract-specific features include modifier (guard) clauses, event notifiers for listeners, and custom global variables.
Some Ethereum contract examples include crowdfunding, voting, and blind auctions.
As Solidity and Ethereum are under active development, experimental or beta features are explicitly marked, and subject to change. Pull requests welcome.
// First, a simple Bank contract
// Allows deposits, withdrawals, and balance checks
// simple_bank.sol (note .sol extension)
/* **** START EXAMPLE **** */
@beetleman
beetleman / redis_asyncio_mq_demo.py
Created June 7, 2016 13:33 — forked from rudyryk/redis_asyncio_mq_demo.py
Simple message queue demo on Redis LPUSH / BRPOP for Python 3.3+ and asyncio.
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""Simple message queue demo on Redis LPUSH / BRPOP for Python 3.3+ and asyncio.
See also "Pattern: Reliable queue" at http://redis.io/commands/rpoplpush to get
an idea for improvement.
"""
import asyncio
import aioredis