This file contains hidden or 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 React, { useEffect, useState, useRef } from 'react'; | |
| import './style.css'; // Assuming your CSS is in the same directory | |
| function ProgressBar() { | |
| const [progressLabel, setProgressLabel] = useState("Loading..."); | |
| const [progressPercentage, setProgressPercentage] = useState(0); | |
| const [progress, setProgress] = useState(0); | |
| const [kneItems, setKneItems] = useState(Array(25).fill(false)); | |
| const progressBarRef = useRef(null); | |
| const progressContainerRef = useRef(null); |
This file contains hidden or 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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or 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
| let | |
| nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11"; | |
| pkgs = import nixpkgs { config = { allowUnfree = true; }; overlays = []; }; | |
| git = pkgs.git.overrideAttrs (oldAttrs: rec { | |
| version = "2.42.0"; | |
| }); | |
| podman = pkgs.podman.overrideAttrs (oldAttrs: rec { | |
| version = "4.7.2"; |
This file contains hidden or 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
| /* Useful celery config. | |
| app = Celery('tasks', | |
| broker='redis://localhost:6379', | |
| backend='redis://localhost:6379') | |
| app.conf.update( | |
| CELERY_TASK_RESULT_EXPIRES=3600, | |
| CELERY_QUEUES=( | |
| Queue('default', routing_key='tasks.#'), |
This file contains hidden or 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 csv | |
| tkp = Category.objects.get(id=3) | |
| tryouts = PremiumTryout.objects.get(id=19) | |
| premium_tryout_answers = PremiumTryoutAnswer.objects.filter(premium_tryout=tryouts, subcategory__category=tkp) | |
| rows = [] | |
| headers = ['id', 'answer', 'question_id', 'question_answer', 'score_a', 'score_b', |
This file contains hidden or 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 ayocasn.apps.categories.models import Subcategory | |
| question_migration = { | |
| 'Nasionalisme': 5, | |
| 'Bela Negara': 5, | |
| 'Integritas': 5, | |
| 'Pilar Negara - Bhinneka Tunggal Ika': 4, | |
| 'Pilar Negara - UUD 1945': 4, | |
| 'Pilar Negara - Pancasila': 4, | |
| 'Pilar Negara - NKRI': 3, |
This file contains hidden or 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 ayocasn.apps.categories.models import Category, Subcategory | |
| # Migration subcategory | |
| cat_id_2 = Category.objects.get(id=2) | |
| cat_id_2.id = 4 | |
| cat_id_2.save() | |
| Subcategory.objects.filter(category_id=2).update(category_id=4) |