class OrganizationMaterialVariantPriceForm(ModelForm):
def __init_subclass__(cls, **kwargs):
if cls.__name__ == OrganizationMaterialVariantPriceForm.__name__:
for color in Color.objects.all():
field_name = f'color_{color.slug}'
cls.declared_fields[field_name] = IntegerField(
label=color.name,
Refs:
// Init new db
// If the database file does not exist, it is created
// This happens synchronously, which means you can start executing queries right away
const Database = require('better-sqlite3');
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
#! /bin/bash | |
openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout priv.key -days 3660 -out cert.pem -subj "/C=XX/O=Default Company/OU=XX/CN=selfsigned.ssh3" -addext "subjectAltName = DNS:selfsigned.ssh3,DNS:*" |
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
#!/usr/bin/env bash | |
cd $(dirname $0) | |
docker run --rm -it -v "$(pwd)":/home/rust/src -v cargo-git:/home/rust/.cargo/git -v cargo-registry:/home/rust/.cargo/registry -v "$(pwd)/target/":/home/rust/src/target ekidd/rust-musl-builder:nightly-2021-01-01 sudo chown -R rust:rust /home/rust/.cargo/git /home/rust/.cargo/registry /home/rust/src/target | |
docker run --rm -it -v "$(pwd)":/home/rust/src -v cargo-git:/home/rust/.cargo/git -v cargo-registry:/home/rust/.cargo/registry -v "$(pwd)/target/":/home/rust/src/target ekidd/rust-musl-builder:nightly-2021-01-01 cargo build --release |
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
# Microphone Realtime background noise reduction script | |
# author Luigi Maselli - https://grigio.org licence: AS-IS | |
# credits: http://askubuntu.com/questions/18958/realtime-noise-removal-with-pulseaudio | |
# run as: sudo && pulseaudio -k | |
# wget -qO - https://gist.github.com/adrianolsk/bfa32f3227dc674eff72a2008f6c0316 | sudo bash && pulseaudio -k | |
sudo cp /etc/pulse/default.pa /etc/pulse/default.pa.bak | |
sudo cat <<EOT >> /etc/pulse/default.pa | |
load-module module-echo-cancel source_name=noechosource sink_name=noechosink |
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
-- Adapted from information_schema.columns | |
SELECT | |
c.oid :: int8 AS table_id, | |
nc.nspname AS schema, | |
c.relname AS table, | |
(c.oid || '.' || a.attnum) AS id, | |
a.attnum AS ordinal_position, | |
a.attname AS name, | |
CASE |
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 java.util.Scanner; | |
public class Cesar { | |
public static void main(String[] args) { | |
Scanner teclado = new Scanner(System.in); | |
char[] mapa = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); | |
int chave = 26; | |
while (chave < 0 || chave > 25) { |
NewerOlder