Skip to content

Instantly share code, notes, and snippets.

View baptadn's full-sized avatar
:shipit:
Bytes hunter-gatherer

Baptiste Adrien baptadn

:shipit:
Bytes hunter-gatherer
View GitHub Profile
import easymidi from 'easymidi';
import notifier from 'node-notifier';
import path from 'path';
import Player from 'play-sound';
import throttle from 'lodash.throttle';
// Settings
const ANSWER_DELAY = 3000;
const RED_BUTTON = 80;
const GREEN_BUTTON = 83;
@baptadn
baptadn / Button.tsx
Last active February 4, 2019 15:48
🌈 TypeScript + Material UI + Styled component + React
import * as React from 'react';
import styled from 'styled-components';
import Button, { ButtonProps } from '@material-ui/core/Button';
interface IProps {
intent?: 'danger' | 'default' | 'success';
}
const ButtonSFC: React.SFC<ButtonProps & IProps> = ({ children, ...props }) => <Button {...props}>{children}</Button>;
import UIKit
extension UIImage {
func resize(to newSize: CGSize) -> UIImage? {
guard self.size != newSize else { return self }
UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0)
self.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height))
@baptadn
baptadn / build.js
Created August 31, 2020 12:29
Activity in an ASCII Apple Macintosh
const axios = require('axios');
const maps = ['A', 'B', 'C', 'D', 'E', 'F'];
const ROWS_COUNT = 6;
const COLUMN_COUNT = 9;
const USERNAME = 'shinework'
let TEMPLATE = `
__________________________
__..--/".' '.
@baptadn
baptadn / dithering.js
Last active October 16, 2020 14:13
Apply a retro dithering effect on an image! hacky hacky! (for https://system1-icons.com/)
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: red; icon-glyph: camera;
const WIDTH = 60;
const HEIGHT = 60;
let widget = await createWidget();
if (!config.runsInWidget) {
from escpos.printer import Serial
""" 9600 Baud, 8N1, Flow Control Enabled """
p = Serial(devfile='/dev/serial0,
baudrate=9600,
bytesize=8,
parity='N',
stopbits=1,
timeout=1.00,
dsrdtr=True)
p.text("Hello World\n")
@baptadn
baptadn / te
Created November 25, 2024 11:32
d