Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Thomas Conté tomconte

🏠
Working from home
View GitHub Profile
@tomconte
tomconte / containerd-certificate-ds.yaml
Last active May 23, 2021
This is a Kubernetes DaemonSet definition that will install a custom certificate on the nodes and restart containerd. This is useful if your private registry is protected using a self-signed certificate. Not tested in production.
View containerd-certificate-ds.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: trusted-ca
namespace: kube-system
data:
ca.crt: |+
-----BEGIN CERTIFICATE-----
MIIFkTCCA3mgAwIBAgIUCXaMcLg8teiGZ7o0dIQRIOdHEA8wDQYJKoZIhvcNAQEL
BQAweDELMAkGA1UEBhMCRlIxDDAKBgNVBAgMA04vQTEMMAoGA1UEBwwDTi9BMSAw
@tomconte
tomconte / bag_to_images.py
Created Jun 18, 2019 — forked from wngreene/bag_to_images.py
Extract images from a rosbag.
View bag_to_images.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 Massachusetts Institute of Technology
"""Extract images from a rosbag.
"""
import os
import argparse
View azuredeploy.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceName": {
"type": "String",
"metadata": {
"description": "The name of the Managed Cluster resource."
}
},
View azuredeploy.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceName": {
"type": "String",
"metadata": {
"description": "The name of the Managed Cluster resource."
}
},
@tomconte
tomconte / fix_horus_calendar.py
Last active Oct 16, 2017
Corrige le calendrier ICS exporté depuis le module emploi du temps de Educ-Horus.
View fix_horus_calendar.py
#!/usr/local/bin/python3
# Corrige le calendrier EducHorus en recopiant le champ DESCRIPTION
# dans le champ SUMMARY pour que les matières apparaissent dans les
# intitulés des évènements.
# Corrige également le fuseau horaire en Europe/Paris.
from dateutil.tz import gettz
from ics import Calendar
@tomconte
tomconte / truffle-config.js
Last active Jul 14, 2019
Example Truffle 3.0 configuration file to allow deploying contracts to an Azure "Bletchley" Ethereum consortium network. Based on the Truffle docs for Infura (http://truffleframework.com/tutorials/using-infura-custom-provider).
View truffle-config.js
var bip39 = require("bip39");
var ethwallet = require('ethereumjs-wallet');
var ProviderEngine = require("web3-provider-engine");
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js');
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");
var Web3 = require("web3");
// Insert raw hex private key here, e.g. using MyEtherWallet
var wallet = ethwallet.fromPrivateKey(Buffer.from('abcdef', 'hex'));
@tomconte
tomconte / compile-deploy-sign.js
Created Jan 3, 2017
Shows how to compile and deploy a Smart Contract using client-side transaction signature, i.e. does not require the account to be unlocked in the Ethereum node.
View compile-deploy-sign.js
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
const Tx = require('ethereumjs-tx')
// Private key to use to sign the transactions
// To decrypt your private key, use e.g. https://www.myetherwallet.com/#view-wallet-info
// You will find your private key file in e.g. .ethereum/keystore or .parity/keys
// In this example the key should correspond to the web3.eth.coinbase address
var privateKey = new Buffer('088c110b6861b6c6c57461370d661301b29a7570d59cb83c6b4f19ec4b47f642', 'hex')
@tomconte
tomconte / tasks.json
Created Dec 14, 2016
Truffle tasks for Visual Studio Code. You can then use them to interact with Truffle, e.g. CTRL-P then "task migrate".
View tasks.json
{
// Truffle tasks for Visual Studio Code
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "truffle",
"isShellCommand": true,
"args": [],
"showOutput": "always",
"echoCommand": true,
@tomconte
tomconte / Token.sol
Created Dec 13, 2016
Super simple Ethereum smart contract for testing.
View Token.sol
pragma solidity ^0.4.0;
contract Token {
mapping (address => uint) public balances;
function Token() {
balances[msg.sender] = 1000000;
}
function transfer(address _to, uint _amount) {
@tomconte
tomconte / web3-solc-contract-compile-deploy.js
Created Dec 13, 2016
Compiling and deploying an Ethereum Smart Contract, using solc and web3.
View web3-solc-contract-compile-deploy.js
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
// Connect to local Ethereum node
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
// Compile the source code
const input = fs.readFileSync('Token.sol');
const output = solc.compile(input.toString(), 1);