Skip to content

Instantly share code, notes, and snippets.

View hastebrot's full-sized avatar

Benjamin Gudehus hastebrot

  • Freiheit.com
  • Hamburg, Germany
  • 06:13 (UTC +02:00)
View GitHub Profile
@hastebrot
hastebrot / ctpuzzle.c
Created November 24, 2019 09:38
Solver for the c't puzzle by Uli Schuhmacher.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define C if
#define T void
#define P NULL
#define U while
#define Z break
#define S return
#define L typedef
@hastebrot
hastebrot / Blocks.txt
Last active November 6, 2019 09:11
Unicode Character Database (12.1.0)
# Blocks-12.1.0.txt
# Date: 2019-03-08, 23:59:00 GMT [KW]
# © 2019 Unicode®, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
#
# Unicode Character Database
# For documentation, see http://www.unicode.org/reports/tr44/
#
# Format:
# Start Code..End Code; Block Name
import React from "react"
import createStore from "storeon"
import useStoreon from "storeon/react"
import StoreContext from "storeon/react/context"
import produce from "immer"
import { Pane, Button } from "fannypack"
export default () => {
return (
<StoreContext.Provider value={store}>
import React, { Fragment, useState, useEffect } from "react"
// this is similar to react's render().
export default () => {
const [state, setState] = useState({ count: 1 })
// this is similar to react's componentDidMount().
useEffect(() => {
setState({ count: 2 })
timeout(500, () => {
; The official HD AI
; An Artificial Intelligence Script written by Archon and Promiskuitiv
; Get in contact with Promiskuitiv by sending a mail to neuernamae@web.de
; List of taunts it reacts to:
; Standard taunts.
; 33 - Stop slinging resources. If slinging is requested early and is immediately canceled it may mess up the strategy.
; 38 - Sling Resources. Human player only, stops any unit production except for civilian units.

1. Separation of immutable and mutable logic

Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a "functional core, imperative shell" seems to be the most voiced.

"Boundaries" - Gary Bernhardt

"Imperative shell" that wraps and uses your "functional core".. The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately. Functional core — Many fast unit tests. Imperative shell — Few integration tests

https://www.youtube.com/watch?v=yTkzNHF6rMs

Mini Guide: kscript and kotlinx.coroutines

$ brew install holgerbrandl/tap/kscript
$ brew install maven
$ kscript demo.kts
Hello from Kotlin!
Hello,
World!
@hastebrot
hastebrot / jira-bookmarklets.md
Last active April 21, 2018 11:52
Browser Bookmarklets for Atlassian Jira

Browser Bookmarklets for Atlassian Jira

Jira is a proprietary issue tracking product, developed by Atlassian. It provides bug tracking, issue tracking, and project management functions.

"Jira (software)." Wikipedia, The Free Encyclopedia.

Usage:

"Installation" of a bookmarklet is performed by creating a new bookmark, and pasting the code into the URL destination field. Alternatively, if the bookmarklet is presented as a link, under some browsers it can be dragged and dropped onto the bookmark bar. The bookmarklet can then be run by loading the bookmark normally.

  • receive / send
  • subscribe / dispatch
  • in / out
  • from server / to server
  • to client / from client
  • input stream / output stream
  • source / sink

Okio includes its own stream types called Source and Sink that work like InputStream and OutputStream

@hastebrot
hastebrot / about:config.md
Created January 13, 2018 21:55 — forked from haasn/about:config.md
Firefox bullshit removal via about:config

Firefox bullshit removal

Due to the incessant swarm of complete and utter nonsense that has been forcing its way into Firefox over time, I've decided to start collecting my personal list of “must-have” about:config tweaks required to turn Firefox into a functional brower.

NOTE: Unfortunately this is somewhat out of date. The comments link to some resources that may be more up-to-date. Patches welcome.

WebSockets

These can be used for nefarious purposes and to bypass access restrictions.