This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# updating NODE | |
# to install node 12 we need install with nvm because the new | |
# installation method (see https://deb.nodesource.com) is only | |
# supported from version 18 | |
ENV NVM_VERSION v0.39.6 | |
ENV NVM_DIR /usr/local/nvm | |
ENV NODE_VERSION v12.22.12 | |
RUN mkdir $NVM_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## https://docs.docker.com/build/building/multi-stage/ | |
## With multi-stage builds, you use multiple FROM statements in your Dockerfile. | |
## Each FROM instruction can use a different base, and each of them begins a new stage of the build. | |
## You can selectively copy artifacts from one stage to another, leaving behind everything you don't | |
## want in the final image. | |
# syntax=docker/dockerfile:1 | |
FROM golang:1.21 as build | |
WORKDIR /src | |
COPY <<EOF /src/main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********* | |
Rui Santos | |
Complete project details at https://randomnerdtutorials.com | |
*********/ | |
#include "Arduino.h" | |
#include <Wire.h> | |
void setup() { | |
Wire.begin(); | |
Serial.begin(9600); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadScript (url, callback) { | |
// Adding the script tag to the head as suggested before | |
var head = document.head; | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = url; | |
// Then bind the event to the callback function. | |
// There are several events for cross browser compatibility. | |
script.onreadystatechange = callback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Annotated | |
class Pepe(object): | |
hola_quillo: Annotated[int, "hola quillo"] | |
yepale: Annotated[float, "yepa.le"] | |
todobien: float | |
def get_display_name(className, varName): | |
from typing import get_type_hints | |
hints = get_type_hints(className, include_extras=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
hi | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Singleton(object): | |
_instance = None | |
def __new__(cls, *args, **kwargs): | |
if not cls._instance: | |
cls._instance = object.__new__(cls, *args, **kwargs) | |
return cls._instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import gzip | |
import os | |
""" | |
create sqlite database from repository radio-browser.info | |
prerequisites: | |
(1) install sqlite3 (client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stripTrailingSpaces(reportNoMatch) | |
local count = 0 | |
local fs,fe = editor:findtext("[ \\t]+$", SCFIND_REGEXP) | |
if fe then | |
repeat | |
count = count + 1 | |
editor:remove(fs,fe) | |
fs,fe = editor:findtext("[ \\t]+$", SCFIND_REGEXP, fs) | |
until not fe | |
print("Removed trailing spaces from " .. count .. " line(s).") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://docs.python.org/3/library/types.html#types.SimpleNamespace | |
class SimpleNamespace: | |
def __init__(self, **kwargs): | |
self.__dict__.update(kwargs) | |
def __repr__(self): | |
keys = sorted(self.__dict__) | |
items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys) | |
return "{}({})".format(type(self).__name__, ", ".join(items)) | |
def __eq__(self, other): |
NewerOlder