Skip to content

Instantly share code, notes, and snippets.

View kennethlynne's full-sized avatar

Kenneth Lynne kennethlynne

View GitHub Profile
@kennethlynne
kennethlynne / gist:cc7ef3015e7332628755cfb14cd4ce54
Created July 8, 2022 10:07 — forked from eighteyes/gist:04c43b6e7c18d8591f2060d75f5aa68f
NodeJS : Spawn STDIN / STDOUT messaging to node process inside a Docker container
// This is the outside in approach, where the parent process is not within Docker, but the child lives in a docker image.
var externalNodeProcess = require('child_process').spawn('docker', [
'run',
'-a', 'stdin', '-a', 'stdout', '-a','stderr',
'-i',
'image/name:tag',
'node','index.js'
], {
stdio: ['pipe', 'pipe', 'pipe']
@kennethlynne
kennethlynne / server.py
Created November 24, 2021 17:58
H4x0r1337
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class Server(BaseHTTPRequestHandler):
def _set_response(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
@kennethlynne
kennethlynne / stockfish-interface.txt
Created March 10, 2021 14:16 — forked from aliostad/stockfish-interface.txt
stockfish - Description of the universal chess interface (UCI)
COPIED FROM https://build.opensuse.org/package/view_file/games/stockfish/stockfish-interface.txt?expand=1
Description of the universal chess interface (UCI) April 2006
=================================================================
* The specification is independent of the operating system. For Windows,
the engine is a normal exe file, either a console or "real" windows application.
* all communication is done via standard input and output with text commands,
@kennethlynne
kennethlynne / data.geojson
Created September 19, 2020 12:45
GeoJson saved from geojson-editor
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kennethlynne
kennethlynne / index.ts
Created March 29, 2020 20:32
Storybook index file
export const StorybookUIRoot = getStorybookUI({
onDeviceUI: false,
shouldDisableKeyboardAvoidingView: true,
});
@kennethlynne
kennethlynne / index.ts
Created March 29, 2020 16:42
Storybook as root
import { registerRootComponent } from 'expo';
import { StorybookUIRoot } from '../storybook/index';
registerRootComponent(StorybookUIRoot);
import { css } from 'styled-components';
export const Typography = {
primary: css`
font-size: 16px;
color: #888;
`,
};
@kennethlynne
kennethlynne / Label.tsx
Created January 6, 2020 12:24
Label.tsx
import styled from 'styled-components/native';
import { Typography } from '~styles';
export type LabelProps = {
children: React.ReactChild;
color?: string;
};
const StyledLabel = styled.Text`
${Typography.primary};
// API-konsument trenger ikke å ta stilling til styling og semantikk
// og kan enkelt importere en komponent med tilhørende styling og adferd i én operasjon
import { Button } from '~components/button';
export const Something = () => <Button onPress={() => alert('42')} />
import styled from 'styled-components/native';
const StyledButton = styled.button`
background: transparent;
border-radius: 3px;
border: 2px solid palevioletred;
color: palevioletred;
margin: 0 1em;
padding: 0.25em 1em;
`;