Skip to content

Instantly share code, notes, and snippets.

@aelindeman
aelindeman / readme.md
Last active October 5, 2025 14:30
ZeroTier on PiKVM

Using ZeroTier on PiKVM

Requires PiKVM OS version 2022.06.20 or newer.

Steps

  1. Install ZeroTier, then start and stop it to generate an identity

@yamnikov-oleg
yamnikov-oleg / formulas.py
Last active July 24, 2023 09:31
An example implementation of a formula evaluator written on top of Python's AST package. See https://blog.oyam.dev/python-formulas/
"""
An example implementation of a formula evaluator written on top of Python's AST package.
See https://blog.oyam.dev/python-formulas/
Usage:
>>> evaluate_formula("a + b", {"a": 1, "b": 2})
3
"""
@tanaikech
tanaikech / submit.md
Last active January 5, 2025 06:09
Simple Script of Resumable Upload with Google Drive API for Node.js

Simple Script of Resumable Upload with Google Drive API for Node.js

This is a simple sample script for achieving the resumable upload to Google Drive using Node.js. In order to achieve the resumable upload, at first, it is required to retrieve the location, which is the endpoint of upload. The location is included in the response headers. After the location was retrieved, the file can be uploaded to the location URL.

In this sample, a PNG file is uploaded with the resumable upload using a single chunk.

Sample script

Before you use this, please set the variables.

@dneuman
dneuman / WrappedText.py
Last active February 7, 2024 06:10
Text Wrapping in Matplotlib
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Wrapping arbitrary text to a defined box is not supported at least up to
Matplotlib 3.1. This is because the wrap width is hardwired to the Figure box.
A way around this is to override the _get_wrap_line_width method, either with
a new function, or by subclassing the matplotlib.text.Text class. Both
methods are shown below.
@tanaikech
tanaikech / submit.md
Last active August 22, 2025 11:57
Upload Files to Google Drive using Javascript

Upload Files to Google Drive using Javascript

News

At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.

Description

This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create() can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.

  • This sample uses gapi.
  • Before you use this, please enable Drive API at API console and carr
@DrPaulBrewer
DrPaulBrewer / UploaderForGoogleDrive.js
Last active December 17, 2022 09:49
Upload Browser Blobs to Files in Google Drive API v3
// upload.js, from https://github.com/googledrive/cors-upload-sample
// Contributors Steve Bazyl, Mike Procopio, Jeffrey Posnick, Renaud Sauvain
// License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0
//
// Implements Resumable Upload for Google Drive as described by
// https://developers.google.com/drive/v3/web/resumable-upload
//
// Modified by Paul Brewer, Economic and Financial Technology Consulting LLC
// Nov. 1 2017
// 1. use Google Drive API V3 instead of V2