Skip to content

Instantly share code, notes, and snippets.

@tony
tony / Chart.tsx
Last active Jan 2, 2021
plotly.js react wrapper component (TypeScript, Functional Component, react-plotly.js alternative)
View Chart.tsx
import React from "react";
import Plotly from "plotly.js/dist/plotly";
export interface ChartProps {
data?: Plotly.Data[];
layout: Partial<Plotly.Layout>;
frames?: Plotly.Frame[];
config?: Partial<Plotly.Config>;
// react-specific
style?: React.CSSProperties;
@tony
tony / compiling_ncmpcpp.rst
Last active Dec 30, 2020
Compiling ncmpcpp on debian jessie
View compiling_ncmpcpp.rst

Install boost libs

$ sudo apt-get install libboost-all-dev

Bug:

@tony
tony / .gitignore
Last active Jun 25, 2020
Code explorer: An informal introduction to reST, docutils, sphinx and extensions for designers and new.
@tony
tony / arch-linux-install
Created Dec 29, 2015 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
View arch-linux-install
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@tony
tony / pipfile-to-poetry.py
Last active Dec 16, 2019 — forked from sobolevn/pipfile-to-poetry.py
Formatting, check for errors for git packages
View pipfile-to-poetry.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import toml
def read_pipenv_lock():
with open('Pipfile.lock') as lock:
return json.loads(lock.read())
View useEventCallback.ts
import React from 'react'
export const useEventCallback = <T extends (...args: any[]) => any>(
callback: T,
dependencies: React.DependencyList,
) => {
const ref = React.useRef(() => {
throw new Error('Cannot call an event handler while rendering.')
})
@tony
tony / fabfile.py
Last active Jul 4, 2018
Can saltstack states and modules play with pure python / fabric? https://github.com/saltstack/salt/issues/22842
View fabfile.py
# -*- coding: utf-8 -*-
"""Proof of concept to use saltstack's pure modules and states with fabric::
fab list_packages print_specs -H <ip> --user=<user>
On my vagrant environment:
fab list_packages print_specs -H <ip> --password=vagrant --user=vagrant
"""
@tony
tony / cihai-corporate-cla.txt
Created Apr 21, 2018
Cihai Foundation Software Grant and Corporate Contributor License Agreement ("Agreement"), v1.0
View cihai-corporate-cla.txt
Cihai Foundation Software Grant and Corporate Contributor License Agreement
("Agreement"), v1.0
You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to Cihai Software Foundation. ("Cihai"). Except
for the license granted herein to Cihai and recipients of software distributed
by Cihai, You reserve all right, title, and interest in and to Your
Contributions.
1. Definitions.
@tony
tony / cihai-individual-cla.txt
Last active Apr 21, 2018
Cihai Software Foundation Individual Contributor License Agreement ("Agreement"), v1.0
View cihai-individual-cla.txt
Cihai Software Foundation Individual Contributor License Agreement
("Agreement"), v1.0
You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to Cihai Software Foundation. ("Cihai"). Except
for the license granted herein to Cihai and recipients of software distributed
by Cihai, You reserve all right, title, and interest in and to Your
Contributions.
1. Definitions.
@tony
tony / flask_pdb.py
Created Apr 2, 2018 — forked from alonho/flask_pdb.py
Flask: drop into pdb on exception
View flask_pdb.py
def drop_into_pdb(app, exception):
import sys
import pdb
import traceback
traceback.print_exc()
pdb.post_mortem(sys.exc_info()[2])
# somewhere in your code (probably if DEBUG is True)
flask.got_request_exception.connect(drop_into_pdb)