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
# Authored by: GregValiant (Greg Foresi) 6/24 | |
# Removes the M104 and M109 hot end temperature prepend lines if 'material_print_temperature' is in the StartUp Gcode (also covers 'material_print_temperature_layer_0') | |
# Removes the M140 and M190 bed temperature prepend lines if 'material_bed_temperature' is in the StartUp Gcode (also covers 'material_bed_temperature_layer_0') | |
# source https://github.com/Ultimaker/Cura/issues/19204#issuecomment-2163070633 | |
from ..Script import Script | |
from UM.Application import Application | |
class CuraPrependBugFix(Script): |
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
Chicken and Sausage Gumbo | |
★★★★★ | |
Cold Weather Recipes, Main Dish, Soups | |
Prep Time: 20 | Cook Time: 2 hr 15 min | Difficulty: Hard | Servings: 8 | |
Ingredients: | |
3 lbs chicken legs (any bone-in pieces work, but I use all chicken legs so it's easy to pick the bones out.) | |
1 lb smoked sausage (I think pork gives the most flavor) | |
3/4 cup vegetable or canola oil | |
1 cup all-purpose flour |
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
# Criando um script .sh para executar todos os comandos: | |
#root@servidor:~# vi script.sh | |
#root@servidor:~# chmod +x script.sh | |
#root@servidor:~# ./script.sh | |
apt-get update | |
apt-get -y install autoconf automake build-essential git-core libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libmp3lame-dev nasm gcc yasm && true | |
mkdir ~/ffmpeg_sources | |
cd ~/ffmpeg_sources | |
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git |
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
CREATE OR REPLACE FUNCTION current_streak_single_year(arr integer[], as_of date) RETURNS INTEGER AS | |
$$ | |
DECLARE | |
total_streak integer := 0; | |
month_streak integer; | |
dt date; | |
BEGIN | |
FOR i IN REVERSE month_index(as_of)..1 LOOP | |
IF date_part('month', as_of) = i THEN | |
dt := as_of; |
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
shifted_checkin = 0000100111011111, computed streak should equal 5 | |
0. starting value | |
0000100111011111 | |
1. invert (~shifted_checkin) | |
1111011000100000 | |
2. compute "shifted_checkin + 1" | |
0000100111011111 + 1 = 0000100111100000 | |
3. AND step 1 & 2 (~shifted_checkin & (shifted_checkin + 1)) | |
1111011000100000 & 0000100111100000 = 0000000000100000 = 32 |
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
-- takes a 2d array of checkins sorted by year desc. | |
-- it is assumed that the first elem in the array is the | |
-- checkins for the same year in the as_of. it will continue to | |
-- call current_streak for the year data until it finds a break in the streak | |
CREATE OR REPLACE FUNCTION current_streak_all_years(arr integer[][], as_of date) RETURNS INTEGER AS | |
$$ | |
DECLARE | |
total_streak integer := 0; | |
year_streak integer; | |
dt date; |
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
CREATE OR REPLACE FUNCTION current_streak_for_month(x integer, as_of date) RETURNS INTEGER AS | |
$$ | |
DECLARE | |
shifted_checkin bigint; | |
rightmost_zero bigint; | |
BEGIN | |
shifted_checkin := x >> 31 - day_of_month(as_of); | |
rightmost_zero := ~shifted_checkin & (shifted_checkin + 1); | |
RETURN log(2, rightmost_zero)::INTEGER; |
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
-- HELPER FUNCTIONS | |
-- returns the day of the month from a date | |
CREATE OR REPLACE FUNCTION day_of_month(dt date) RETURNS INTEGER AS | |
$$ | |
SELECT DATE_PART('days', dt)::INTEGER | |
$$ LANGUAGE SQL; | |
-- returns the numeric (1-12) value for a month from a date | |
CREATE OR REPLACE FUNCTION month_index(dt date) RETURNS INTEGER AS |
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
CREATE TABLE "public"."streaks_checkins" ( | |
"user_id" int4 NOT NULL, | |
"year" int2 NOT NULL, | |
"checkins" int4[] NOT NULL DEFAULT '{0,0,0,0,0,0,0,0,0,0,0,0}'::integer[], | |
CONSTRAINT "streaks_checkins_pkey" PRIMARY KEY ("user_id", "year") NOT DEFERRABLE INITIALLY IMMEDIATE | |
) |
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
UPDATE streaks | |
SET current_streak = ( | |
CASE | |
WHEN %(date)s - last_checkin_dt = 1 THEN current_streak + 1 | |
ELSE 1 | |
END | |
), | |
longest_streak = GREATEST(longest_streak, ( | |
CASE | |
WHEN %(date)s - last_checkin_dt = 1 THEN current_streak + 1 |
NewerOlder