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;
// CAUTION
// 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
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
[tool.poetry]
name = "test_project"
version = "0.1.0"
description = ""
authors = ["Laurent 'c2ba' NOËL"]
license = "MIT"
[tool.poetry.dependencies]
python = "3.8.5"
@Celeborn2BeAlive
Celeborn2BeAlive / README.md
Created Sep 16, 2020 — forked from Hopobcn/README.md
gitlab-runner configuration file with docker runner for using NVIDIA GPUs (nvidia-docker)
View README.md

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
Celeborn2BeAlive / Local PR test and merge.md
Created Sep 15, 2020 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU
View Local PR test and merge.md

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
Celeborn2BeAlive / install-package.sh
Created Sep 12, 2020 — forked from pgilad/install-package.sh
Install a pip package using Poetry and use pre-release version
View install-package.sh
# An example on how to install poetry preview version
$ pipx install poetry --pip-args="--pre"
@Celeborn2BeAlive
Celeborn2BeAlive / log_exec.py
Created Sep 8, 2020 — forked from mckaydavis/log_exec.py
Python non-blocking reading from stdout and stderr of subprocess.popen process using os.pipe and select.select
View log_exec.py
#!/usr/bin/env python
# File: log_exec.py
# Author: McKay Davis
# Date: Jun 23, 2014
# Non-blocking stdout and stderr read from a
# Popen process
import os
import subprocess
View pyproject.toml
[tool.poetry]
name = "c2ba_hypermodern_python"
version = "0.1.0"
description = "Project built by going through Hypermodern Python tutorial"
homepage = "https://gitlab.com/c2ba_sandbox/sandbox_python/hypermodern_python"
repository = "https://gitlab.com/c2ba_sandbox/sandbox_python/"
authors = ["Celeborn2BeAlive <laurent.noel.c2ba@gmail.com>"]
keywords = ["hypermodern", "python", "tutorial"]
[tool.poetry.dependencies]
@Celeborn2BeAlive
Celeborn2BeAlive / build_otio_wheel.sh
Created May 20, 2020
Shell script to build a wheel of OpenTimelineIO 0.12.1
View build_otio_wheel.sh
#!/bin/bash
# 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`
ROOT_DIR=$CURRENT_DIR/
@Celeborn2BeAlive
Celeborn2BeAlive / nodetest.py
Created Feb 21, 2020 — forked from OEP/nodetest.py
Basic script for Blender Python nodes
View nodetest.py
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",
}