Skip to content

Instantly share code, notes, and snippets.

View .deps...github...OpenZeppelin...openzeppelin-contracts...contracts...utils...math...SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
Celeborn2BeAlive / gist:bd6bd165b84080eeb4ec22ff3ecbafd3
Created Dec 3, 2020
Copy Markdown Link Bookmarklet (only works for https)
View gist:bd6bd165b84080eeb4ec22ff3ecbafd3
javascript:(function(){s=`[${document.querySelector("title").innerHTML}](${window.location})`;elt=document.querySelector(".ytp-time-duration");if(elt){s=`${s} ⏳ ${elt.innerHTML}`;}navigator.clipboard.writeText(s).then(()=>{alert(s)});})()
View pyproject_bug.toml
name = "test_project"
version = "0.1.0"
description = ""
authors = ["Laurent 'c2ba' NOËL"]
license = "MIT"
python = "3.8.5"
Celeborn2BeAlive /
Created Sep 16, 2020 — forked from Hopobcn/
gitlab-runner configuration file with docker runner for using NVIDIA GPUs (nvidia-docker)

Use Gitlab-CI with GPU support

Since gitlab-runner cannot be forced to use nvidia-docker wrapper, follow this steps:

  1. Install all required software: docker, nvidia-docker, gitlab-ci-multi-runner
  2. Execute: curl -s http://localhost:3476/docker/cli
  3. Use that data to fill devices/volumes/volume_driver fields in /etc/gitlab-runner/config.toml
Celeborn2BeAlive / Local PR test and
Created Sep 15, 2020 — forked from adam-p/Local PR test and
Testing a pull request, then merging locally; and avoiding TOCTOU
View Local PR test and

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
Celeborn2BeAlive /
Created Sep 12, 2020 — forked from pgilad/
Install a pip package using Poetry and use pre-release version
# An example on how to install poetry preview version
$ pipx install poetry --pip-args="--pre"
Celeborn2BeAlive /
Created Sep 8, 2020 — forked from mckaydavis/
Python non-blocking reading from stdout and stderr of subprocess.popen process using os.pipe and
#!/usr/bin/env python
# File:
# Author: McKay Davis
# Date: Jun 23, 2014
# Non-blocking stdout and stderr read from a
# Popen process
import os
import subprocess
View pyproject.toml
name = "c2ba_hypermodern_python"
version = "0.1.0"
description = "Project built by going through Hypermodern Python tutorial"
homepage = ""
repository = ""
authors = ["Celeborn2BeAlive <>"]
keywords = ["hypermodern", "python", "tutorial"]
Celeborn2BeAlive /
Created May 20, 2020
Shell script to build a wheel of OpenTimelineIO 0.12.1
# This script generate a wheel for OpenTimelineIO in dist folder
# We need it has a patch to install otio 0.12.1 in Windows Blender because it requires compilation
# This wheel should be distributed with code that depends on otio 0.12.1 and installed using Blender's python -m pip
# You need python (3.7.*) and Visual Studio 2017+
CURRENT_DIR=`dirname $0`
Celeborn2BeAlive /
Created Feb 21, 2020 — forked from OEP/
Basic script for Blender Python nodes
import bpy
from bpy.props import IntProperty, FloatProperty, PointerProperty
import nodeitems_utils
from nodeitems_utils import NodeItem, NodeCategory
bl_info = {
"name": "Custom nodes",
"category": "Node",