Skip to content

Instantly share code, notes, and snippets.

# Connectiong by SSH from Android Termux to Desktop and vice-versa.md
# Copyright (c) 2019 Evandro Coan
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# My Google Chrome Extensions.md
# Copyright (c) 2022-2024 Evandro Coan
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@evandrocoan
evandrocoan / .gitignore
Last active March 11, 2024 15:04
Simple C++ program example to run tests together with your code using doctest.
/build

conan-io/conan#6064 (comment)

    def test_transitive_editables_build(self):
        c = TestClient()
        libb = textwrap.dedent("""\
            from conan import ConanFile
            class LibB(ConanFile):
                name = "libb"
                version = "0.1"

Bundle npm package for browser

  1. Include the packages you want to bundle for browser
    1. npm install --save pretty
  2. Edit index.js to export the functions you want to use
@evandrocoan
evandrocoan / mmap_python_usage.md
Last active July 25, 2023 08:47
Example of shared memory usage in python using mmap!
import mmap
import time
import sys
import json

# https://docs.python.org/3.9/library/mmap.html
# https://blog.askesis.pl/post/2019/02/mmap.html
memory = mmap.mmap( -1, 20, access=mmap.ACCESS_WRITE )
# Remove files from all commits with bfg.jar.md
# Copyright (c) 2019 Evandro Coan
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@evandrocoan
evandrocoan / README.md
Last active February 1, 2023 13:37
Change vmware ip address remotely with ssh with auto recover in case things go wrong
  1. Run df -h to see if you have the volume /vmfs/volumes/datastore1 or datastore1
  2. Create the file /vmfs/volumes/datastore1/backup.sh to test it calling /vmfs/volumes/datastore1/backup.sh to know this script is compatible with your sh version
  3. Before testing, check if your /etc/rc.local shell bang is #! /bin/sh, and update it here if not
  4. Check if your WMware is running on UTC or in your local time zone with date command
  5. Create the backup file with cp -v /etc/vmware/esx.conf /vmfs/volumes/datastore1/esx.conf
    • Put files backup files on /vmfs/volumes/xxx because else where vmware will delete them after reboot
    • Run chmod +x /vmfs/volumes/datastore1/backup.sh
    • Edit /etc/rc.local.d/local.sh and add the line /vmfs/volumes/datastore1/backup.sh
    • Edit /vmfs/volumes/datastore1 to your correct data volume
@evandrocoan
evandrocoan / generate_certificate.sh
Created January 5, 2022 13:05
Generated an ssl private/public SSL certificate
#!/bin/bash
set -x
set -eu -o pipefail
function printerror
{
set +x
printf '\n'
printf 'Usage\n'
printf ' %s "key name" "key password" "servidor ip" "server name (i.e., $HOSTNAME)"\n' "$0"
@evandrocoan
evandrocoan / convert_yaml_json.py
Created January 10, 2023 00:53
Convert Anki decks from JSON to YAML and vice versa.
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import timeit
import datetime
import argparse
import tempfile
import pathlib