diff --git a/pastes/pastes_20231210001817.csv b/pastes/pastes_20231210001817.csv new file mode 100644 index 00000000..fec4d556 --- /dev/null +++ b/pastes/pastes_20231210001817.csv @@ -0,0 +1,6946 @@ +id,title,username,language,date,content +mwv9TQRg,2023-12-09_stats.json,rdp_snitch,JSON,Saturday 9th of December 2023 06:16:09 PM CDT,"{ + ""ip"": { + ""2.57.149.92"": 4, + ""194.165.17.21"": 28, + ""87.251.75.145"": 6, + ""87.251.75.179"": 2, + ""167.248.133.51"": 2, + ""198.235.24.198"": 6, + ""62.204.41.240"": 8, + ""196.190.117.7"": 6, + ""162.142.125.223"": 2, + ""43.134.195.10"": 4, + ""212.70.149.146"": 2, + ""87.251.75.64"": 2, + ""194.165.16.72"": 4, + ""85.209.11.23"": 4, + ""51.75.160.42"": 8, + ""193.29.13.175"": 2, + ""185.170.144.3"": 4, + ""37.34.179.6"": 2, + ""210.2.165.44"": 2, + ""198.235.24.111"": 6, + ""195.130.73.252"": 2, + ""179.60.147.5"": 2, + ""176.113.115.13"": 6, + ""45.227.254.8"": 4, + ""103.167.92.115"": 6, + ""152.32.197.166"": 2, + ""205.210.31.192"": 6, + ""117.1.28.84"": 2, + ""103.183.121.117"": 2, + ""114.216.3.135"": 6, + ""36.133.110.87"": 6, + ""205.210.31.232"": 6, + ""194.165.16.73"": 4 + }, + ""asn"": { + ""AS208312"": 4, + ""AS48721"": 36, + ""AS208091"": 10, + ""AS398324"": 4, + ""AS396982"": 24, + ""AS59425"": 8, + ""AS24757"": 6, + ""AS132203"": 4, + ""AS204428"": 2, + ""AS57523"": 4, + ""AS16276"": 8, + ""AS42397"": 2, + ""AS197414"": 4, + ""AS42961"": 2, + ""AS23966"": 2, + ""AS5408"": 2, + ""AS209588"": 2, + ""AS57678"": 6, + ""AS267784"": 4, + ""AS63737"": 6, + ""AS135377"": 2, + ""AS7552"": 2, + ""AS135918"": 2, + ""AS4134"": 6, + ""AS9808"": 6 + }, + ""isp"": { + ""Red Byte LLC"": 4, + ""Flyservers S.A."": 42, + ""Xhost Internet Solutions LP"": 14, + ""Censys, Inc."": 4, + ""Google LLC"": 24, + ""Horizon LLC"": 8, + ""Ethiotelecom"": 6, + ""Shenzhen Tencent Computer Systems Company Limited"": 4, + ""SS-Net"": 2, + ""Chang Way Technologies Co. Limited"": 4, + ""OVH SAS"": 8, + ""Bunea TELECOM SRL"": 2, + ""Mobile Telecommunications Company"": 2, + ""LINKdotNET Telecom Limited"": 2, + ""T-epirus - UOI"": 2, + ""Cat Technologies Co. Limited"": 6, + ""Vietserver Services Technology Company Limited"": 6, + ""UCLOUD INFORMATION TECHNOLOGY (HK) LIMITED"": 2, + ""Viettel Corporation"": 2, + ""GRCITY"": 2, + ""Chinanet"": 6, + ""China Mobile"": 6 + }, + ""org"": { + ""Chang Way Technologies Co. Limited"": 8, + ""Flyservers S.A"": 36, + ""Xhost Internet Solutions"": 10, + ""Censys, Inc."": 2, + ""Palo Alto Networks, Inc"": 24, + ""Horizon LLC"": 8, + ""Unknown"": 10, + ""Censys Inc"": 2, + ""Tencent Cloud Computing"": 4, + ""4Media Ltd"": 2, + ""OVH Ltd"": 8, + ""Bunea TELECOM SRL"": 2, + ""Xhostis"": 4, + ""Zain"": 2, + ""Dancom ISB"": 2, + ""Cloud Solutions S.A"": 2, + ""Cat Technologies Co. Limited"": 6, + ""UAB Host Baltic"": 4, + ""Vnnetwork Network Solution Company Limited"": 6, + ""Ucloud Information Technology (hk) Limited"": 2, + ""GREEN CITY Construction Investment Joint Stock Company"": 2, + ""Chinanet JS"": 6, + ""China Mobile Communications Corporation"": 6 + }, + ""regionName"": { + ""Lesser Poland"": 4, + ""Kaunas"": 36, + ""North Holland"": 14, + ""Michigan"": 4, + ""California"": 24, + ""Moscow"": 18, + ""Addis Ababa"": 6, + ""Central and Western District"": 4, + ""Plovdiv"": 2, + ""England"": 8, + ""Timi\u015f"": 2, + ""Al Asimah"": 2, + ""Islamabad"": 2, + ""Attica"": 2, + ""Distrito Federal"": 2, + ""Vilnius"": 4, + ""Hanoi"": 6, + ""Sao Paulo"": 2, + ""Haiphong"": 2, + ""Gia Lai"": 2, + ""Jiangsu"": 6, + ""Guangdong"": 6 + }, + ""country"": { + ""Poland"": 4, + ""Lithuania"": 40, + ""The Netherlands"": 14, + ""United States"": 28, + ""Russia"": 18, + ""Ethiopia"": 6, + ""Hong Kong"": 4, + ""Bulgaria"": 2, + ""United Kingdom"": 8, + ""Romania"": 2, + ""Kuwait"": 2, + ""Pakistan"": 2, + ""Greece"": 2, + ""Venezuela"": 2, + ""Vietnam"": 10, + ""Brazil"": 2, + ""China"": 12 + }, + ""account"": { + ""Administr"": 26, + ""hello"": 56, + ""(empty)"": 6, + ""jwheAZtbK"": 2, + ""lOdosN"": 2, + ""omkFSv"": 2, + ""Test"": 32, + ""FiJJmgeUK"": 2, + ""NSErdE"": 2, + ""xeVvDH"": 2, + ""Domain"": 10, + ""Administrator"": 2, + ""kiIEIVorK"": 2, + ""TzJOSU"": 2, + ""bbJwmh"": 2, + ""Almaz"": 2, + ""RlOsKgZxq"": 2, + ""zydCPc"": 2, + ""wGyGhv"": 2 + }, + ""keyboard"": { + ""Unknown"": 158 + }, + ""client_build"": { + ""Unknown"": 158 + }, + ""client_name"": { + ""Unknown"": 158 + }, + ""ip_type"": { + ""Unknown"": 108, + ""hosting"": 38, + ""proxy"": 2, + ""mobile"": 10 + } +}" +EWWwbjpg,2023-12-09_stats.json,rdp_snitch,JSON,Saturday 9th of December 2023 06:15:08 PM CDT,"{ + ""ip"": { + ""2.57.149.92"": 2, + ""194.165.17.21"": 14, + ""87.251.75.145"": 3, + ""87.251.75.179"": 1, + ""167.248.133.51"": 1, + ""198.235.24.198"": 3, + ""62.204.41.240"": 4, + ""196.190.117.7"": 3, + ""162.142.125.223"": 1, + ""43.134.195.10"": 2, + ""212.70.149.146"": 1, + ""87.251.75.64"": 1, + ""194.165.16.72"": 2, + ""85.209.11.23"": 2, + ""51.75.160.42"": 4, + ""193.29.13.175"": 1, + ""185.170.144.3"": 2, + ""37.34.179.6"": 1, + ""210.2.165.44"": 1, + ""198.235.24.111"": 3, + ""195.130.73.252"": 1, + ""179.60.147.5"": 1, + ""176.113.115.13"": 3, + ""45.227.254.8"": 2, + ""103.167.92.115"": 3, + ""152.32.197.166"": 1, + ""205.210.31.192"": 3, + ""117.1.28.84"": 1, + ""103.183.121.117"": 1, + ""114.216.3.135"": 3, + ""36.133.110.87"": 3, + ""205.210.31.232"": 3, + ""194.165.16.73"": 2 + }, + ""asn"": { + ""AS208312"": 2, + ""AS48721"": 18, + ""AS208091"": 5, + ""AS398324"": 2, + ""AS396982"": 12, + ""AS59425"": 4, + ""AS24757"": 3, + ""AS132203"": 2, + ""AS204428"": 1, + ""AS57523"": 2, + ""AS16276"": 4, + ""AS42397"": 1, + ""AS197414"": 2, + ""AS42961"": 1, + ""AS23966"": 1, + ""AS5408"": 1, + ""AS209588"": 1, + ""AS57678"": 3, + ""AS267784"": 2, + ""AS63737"": 3, + ""AS135377"": 1, + ""AS7552"": 1, + ""AS135918"": 1, + ""AS4134"": 3, + ""AS9808"": 3 + }, + ""isp"": { + ""Red Byte LLC"": 2, + ""Flyservers S.A."": 21, + ""Xhost Internet Solutions LP"": 7, + ""Censys, Inc."": 2, + ""Google LLC"": 12, + ""Horizon LLC"": 4, + ""Ethiotelecom"": 3, + ""Shenzhen Tencent Computer Systems Company Limited"": 2, + ""SS-Net"": 1, + ""Chang Way Technologies Co. Limited"": 2, + ""OVH SAS"": 4, + ""Bunea TELECOM SRL"": 1, + ""Mobile Telecommunications Company"": 1, + ""LINKdotNET Telecom Limited"": 1, + ""T-epirus - UOI"": 1, + ""Cat Technologies Co. Limited"": 3, + ""Vietserver Services Technology Company Limited"": 3, + ""UCLOUD INFORMATION TECHNOLOGY (HK) LIMITED"": 1, + ""Viettel Corporation"": 1, + ""GRCITY"": 1, + ""Chinanet"": 3, + ""China Mobile"": 3 + }, + ""org"": { + ""Chang Way Technologies Co. Limited"": 4, + ""Flyservers S.A"": 18, + ""Xhost Internet Solutions"": 5, + ""Censys, Inc."": 1, + ""Palo Alto Networks, Inc"": 12, + ""Horizon LLC"": 4, + ""Unknown"": 5, + ""Censys Inc"": 1, + ""Tencent Cloud Computing"": 2, + ""4Media Ltd"": 1, + ""OVH Ltd"": 4, + ""Bunea TELECOM SRL"": 1, + ""Xhostis"": 2, + ""Zain"": 1, + ""Dancom ISB"": 1, + ""Cloud Solutions S.A"": 1, + ""Cat Technologies Co. Limited"": 3, + ""UAB Host Baltic"": 2, + ""Vnnetwork Network Solution Company Limited"": 3, + ""Ucloud Information Technology (hk) Limited"": 1, + ""GREEN CITY Construction Investment Joint Stock Company"": 1, + ""Chinanet JS"": 3, + ""China Mobile Communications Corporation"": 3 + }, + ""regionName"": { + ""Lesser Poland"": 2, + ""Kaunas"": 18, + ""North Holland"": 7, + ""Michigan"": 2, + ""California"": 12, + ""Moscow"": 9, + ""Addis Ababa"": 3, + ""Central and Western District"": 2, + ""Plovdiv"": 1, + ""England"": 4, + ""Timi\u015f"": 1, + ""Al Asimah"": 1, + ""Islamabad"": 1, + ""Attica"": 1, + ""Distrito Federal"": 1, + ""Vilnius"": 2, + ""Hanoi"": 3, + ""Sao Paulo"": 1, + ""Haiphong"": 1, + ""Gia Lai"": 1, + ""Jiangsu"": 3, + ""Guangdong"": 3 + }, + ""country"": { + ""Poland"": 2, + ""Lithuania"": 20, + ""The Netherlands"": 7, + ""United States"": 14, + ""Russia"": 9, + ""Ethiopia"": 3, + ""Hong Kong"": 2, + ""Bulgaria"": 1, + ""United Kingdom"": 4, + ""Romania"": 1, + ""Kuwait"": 1, + ""Pakistan"": 1, + ""Greece"": 1, + ""Venezuela"": 1, + ""Vietnam"": 5, + ""Brazil"": 1, + ""China"": 6 + }, + ""account"": { + ""Administr"": 13, + ""hello"": 28, + ""(empty)"": 3, + ""jwheAZtbK"": 1, + ""lOdosN"": 1, + ""omkFSv"": 1, + ""Test"": 16, + ""FiJJmgeUK"": 1, + ""NSErdE"": 1, + ""xeVvDH"": 1, + ""Domain"": 5, + ""Administrator"": 1, + ""kiIEIVorK"": 1, + ""TzJOSU"": 1, + ""bbJwmh"": 1, + ""Almaz"": 1, + ""RlOsKgZxq"": 1, + ""zydCPc"": 1, + ""wGyGhv"": 1 + }, + ""keyboard"": { + ""Unknown"": 79 + }, + ""client_build"": { + ""Unknown"": 79 + }, + ""client_name"": { + ""Unknown"": 79 + }, + ""ip_type"": { + ""Unknown"": 54, + ""hosting"": 19, + ""proxy"": 1, + ""mobile"": 5 + } +}" +FacT4BuG,# image_editor.py,here2share,Python,Saturday 9th of December 2023 05:06:27 PM CDT,"# image_editor.py -- ZZZ looking to add a variant slider... maybe having 0 equals neutral sharpness while 500 equals maximum blur... or... one screen length slider to search through every smooth color combination. The randomness is just to test the code for now. + +import tkinter as tk +import random +from PIL import Image, ImageTk, ImageFilter +import time + +ww = 500 +hh = 500 + +root = tk.Tk() +root.title(""Variant Interpolate"") +root.geometry(""%dx%d+%d+%d"" %(ww, hh, 10, 10)) + +canvas = tk.Canvas(root, width=ww, height=hh) +canvas.pack() + +def up_arrow(event): + global y + y = max(0, y-10) + move_topwin() +def down_arrow(event): + global y + y = min(hh-10, y+10) + move_topwin() + +def left_arrow(event): + global x + x = max(0, x-10) + move_topwin() + +def right_arrow(event): + global x + x = min(ww-10, x+10) + move_topwin() + +def update_color(event=None): + red = red_slider.get() + green = green_slider.get() + blue = blue_slider.get() + pixels[x // 10, y // 10] = (red, green, blue) + interpolate() + +def on_click(event): + global x, y + x, y = event.x, event.y + move_topwin() + +def toggle_circle_visibility(event=None): + global circle_visible + circle_visible = not circle_visible + +def move_topwin(): + x0 = y0 = 35 + if x > ww - 230: + x0 = -230 + x0 = root.winfo_x() + x0 + x + y0 = root.winfo_y() + y0 + min(y, hh - 150) + color_window.geometry(f""+{x0}+{y0}"") + + red, green, blue = pixels[x // 10, y // 10] + red_slider.set(red) + green_slider.set(green) + blue_slider.set(blue) + +canvas.bind("""", on_click) + +def interpolate(): + canvas.delete('all') + + resized_image = canvas_image.resize((ww, hh), resample=Image.BICUBIC) + + blurred_image = resized_image.filter(ImageFilter.GaussianBlur(3.2)) + + photo = ImageTk.PhotoImage(blurred_image) + canvas.create_image(0, 0, anchor=tk.NW, image=photo) + canvas.image = photo + +def xyfocus(): + global iii + canvas.delete(""circle"") + if circle_visible: + x0 = x // 10 * 10 + y0 = y // 10 * 10 + c = grayscale[iii] + outline_color = f""#{c:02x}{c:02x}{c:02x}"" + canvas.create_oval(x0 - 20, y0 - 20, x0 + 30, y0 + 30, + fill='', outline=outline_color, width=3, tags=""circle"") + iii = (iii + 1) % Lgray + root.after(1, xyfocus) + +canvas_image = Image.new(""RGB"", (50, 50)) +pixels = canvas_image.load() +for y in range(50): + for x in range(50): + red = random.randint(0, 255) + green = random.randint(0, 255) + blue = random.randint(0, 255) + pixels[x, y] = (red, green, blue) +interpolate() + +iii = range(0, 256, 2) +grayscale = [] +for i in iii: + grayscale += [(i)] +for i in iii: + grayscale += [(255-i)] +Lgray = len(grayscale) + +color_window = tk.Toplevel(root) +red_slider = tk.Scale(color_window, from_=255, to=0, orient=tk.VERTICAL, label=""R"", command=update_color) +red_slider.pack(side=tk.LEFT) + +green_slider = tk.Scale(color_window, from_=255, to=0, orient=tk.VERTICAL, label=""G"", command=update_color) +green_slider.pack(side=tk.LEFT) + +blue_slider = tk.Scale(color_window, from_=255, to=0, orient=tk.VERTICAL, label=""B"", command=update_color) +blue_slider.pack(side=tk.LEFT) + +color_window.geometry(""+%d+%d"" %(100, 100)) +color_window.wm_transient(root) + +x = y = 0 +circle_visible = 1 + +red, green, blue = pixels[x // 10, y // 10] +red_slider.set(red) +green_slider.set(green) +blue_slider.set(blue) + +for t in (root, color_window): + t.bind("""", up_arrow) + t.bind("""", down_arrow) + t.bind("""", left_arrow) + t.bind("""", right_arrow) + + t.bind("""", toggle_circle_visibility) + +def adjust_slider(event, slider): + slider.set(max(0, min(255, slider.get() + (1 if event.keysym in 'qwe' else -1)))) + update_color() + +bindings = { + """": red_slider, + """": red_slider, + """": green_slider, + """": green_slider, + """": blue_slider, + """": blue_slider +} + +for key, slider in bindings.items(): + color_window.bind(key, lambda event, slider=slider: adjust_slider(event, slider)) + +iii = 0 +xyfocus() + +root.mainloop()" +NBPD3g24,Untitled,sissou123,C#,Saturday 9th of December 2023 05:04:10 PM CDT,"Design Patterns in C# and .NET +Discover the modern implementation of design patterns with C# and .NET +This course provides a comprehensive overview of Design Patterns in C# and .NET from a practical perspective +for more:https://cuty.io/FWxG" +sQ1LWYyR,Untitled,sissou123,C#,Saturday 9th of December 2023 04:56:38 PM CDT,"C# 10 | Ultimate Guide - Beginner to Advanced | Master class +Learn C# by doing | C# projects | Bootcamp for C# Interview | Advanced C# | Collections | LINQ | Interview Questions +for more:https://cuty.io/hXNo" +we4jS46i,AoC 2023 day 9 (Smalltalk),musifter,Smalltalk,Saturday 9th of December 2023 04:53:45 PM CDT,"#!/usr/local/bin/gst -q + +Symbol extend [ value: arg [^arg perform: self] ] + +SequenceableCollection extend [ + "" Returns collection of results from calling binBlock for each link pair "" + chain: binBlock [ + | res | + res := self copyEmptyForCollect. + self fold: [:curr :next | res add: (binBlock value: curr value: next). next]. + ^res + ] +] + +"" +| Mainline +"" +input := stdin lines contents collect: [:line | line subStrings collect: #asNumber]. + +part1 := 0. +part2 := 0. +input do: [:seq | + row := seq. + firsts := OrderedCollection new. + + [row conform: [:n | n = 0]] whileFalse: [ + "" Use last to do part1 now, save first to do part2 after: "" + part1 := part1 + row last. + firsts add: row first. + + row := row chain: [:a :b | b - a]. + ]. + + part2 := part2 + (firsts reverse fold: [:a :b | b - a]). +]. + + +('Part 1: %1' % {part1}) displayNl. +('Part 2: %1' % {part2}) displayNl. +" +BvM2QNhd,Untitled,sissou123,C#,Saturday 9th of December 2023 04:52:46 PM CDT,"Learn C# Programming (In Ten Easy Steps) +Learn C# Programming (in ten easy steps) [Version 2] is suitable for beginner programmers or anyone with experience in another programming language who needs to learn C# from the ground up. Step-by-step it explains how to write C# code to develop Windows applications using either the free Visual Studio Community Edition +for more:https://dz-linkk.com/qqirDi" +CFePnbs9,Untitled,sissou123,CSS,Saturday 9th of December 2023 04:45:51 PM CDT," +Advanced CSS and Sass: Flexbox, Grid, Animations and More! +The most advanced and modern CSS course on the internet: master flexbox, CSS Grid, responsive design, and so much more. +for more:https://dz4link.com/cWGlqGB" +B1Dyu7DY,Untitled,sissou123,CSS,Saturday 9th of December 2023 04:41:17 PM CDT,"Advanced CSS and Sass: Flexbox, Grid, Animations and More! +The most advanced and modern CSS course on the internet: master flexbox, CSS Grid, responsive design, and so much more. +for more:https://dz-linkk.com/xOtxOF" +tByUsjca,Untitled,sissou123,JavaScript,Saturday 9th of December 2023 04:37:46 PM CDT,"JavaScript - The Complete Guide 2023 (Beginner + Advanced) +Modern JavaScript from the beginning - all the way up to JS expert level! THE must-have JavaScript resource in 2023. +for more:https://dz-linkk.com/0Q89hu" +HDsZ0G0w,Untitled,mzh_pb,C++,Saturday 9th of December 2023 04:28:15 PM CDT,"#include +#include + +#define int int64_t + +#define rng(i, a, b) for (int i = a; i < b; i++) +#define rep(i, b) rng(i, 0, b) +#define gnr(i, a, b) for (int i = b - 1; i >= a; i--) +#define per(i, b) gnr(i, 0, b) + +#define all(x) begin(x), end(x) +#define sz(x) int(size(x)) + +#define pb push_back +#define eb emplace_back +#define lb lower_bound +#define ub upper_bound + +#define f first +#define s second + +using namespace std; +using namespace __gnu_pbds; + +constexpr int MOD = 1e9 + 7; // 998244353 + +struct Mint { + int v; + + Mint() : v(0) {} + Mint(int64_t _v) { + v = (-MOD < _v && _v < MOD ? _v : _v % MOD); + if (v < 0) { + v += MOD; + } + }; + + Mint operator+(Mint b) { return Mint(v + b.v); } + Mint operator-(Mint b) { return Mint(v - b.v); } + Mint operator*(Mint b) { return Mint(1ll * v * b.v); } + Mint operator/(Mint b) { return Mint(1ll * v * b.inv().v); } + + Mint pow(int e) { + Mint b = *this; + Mint ret = 1; + while (e != 0) { + if (e & 1) { + ret = ret * b; + } + b = b * b; + e >>= 1; + } + return ret; + } + + Mint inv() { + return pow(MOD - 2); + } +}; + +void solve() { + int n; + cin >> n; + vector> segs(n); + vector lefts, rights; + for (auto &[l, r] : segs) { + cin >> l >> r; + lefts.pb(l); + rights.pb(r); + } + sort(all(lefts)); + sort(all(rights)); + + Mint ans = 0; + for (auto [l, r] : segs) { + int end_before = lb(all(rights), l) - rights.begin(); + int start_after = n - (ub(all(lefts), l) - lefts.begin()); + ans = ans + Mint(2).pow(end_before + start_after); + + // cout << end_before << ' ' << start_after << '\n'; + } + cout << ans.v << '\n'; +} + +int32_t main() { +#ifndef LOCAL + freopen(""help.in"", ""r"", stdin); + freopen(""help.out"", ""w"", stdout); +#endif + ios::sync_with_stdio(false); + cin.tie(nullptr); + + int tc = 1; + // cin >> tc; + while (tc--) { + solve(); + } + + return 0; +}" +kCC2aPJW,G2A Refund Exploit Dec 2023,G2ARefundExploit,GetText,Saturday 9th of December 2023 04:17:28 PM CDT,"G2A refund exploit updated guide - any item for free on G2A.com + +https://drive.google.com/file/d/1thJ3r_goEZ3BA-wE8sNYbGUhGv6gTnXz/view#g2a_refund_exploit.pdf + +Working as of +09 December 2023 + +641931" +gUAjb80L,Tunneler (Left Turtle),M4ND4RiM,Lua,Saturday 9th of December 2023 03:42:26 PM CDT,"-- Tunneler code for Create Astral modpack + -- Code adapated from 'ComputerCraft DFS Mining' from '0XSHAWN' in pastebin + + + +-- 🗺️ Variable declaration +-- ================================= + +-- Block type used to fill the holes after mining +local FILL_BLOCKS = { + [""minecraft:cobblestone""]=true, + [""minecraft:granite""]=true, + [""minecraft:diorite""]=true, + [""minecraft:andesite""]=true, + [""minecraft:cobbled_deepslate""]=true, + [""minecraft:dirt""]=true, + [""ad_astra:moon_cobblestone""]=true, + [""ad_astra:mars_cobblestone""]=true, + [""ad_astra:venus_cobblestone""]=true, + [""ad_astra:mercury_cobblestone""]=true, + [""ad_astra:glacio_cobblestone""]=true, +} + +-- Table containing the whitelist of ores to mine +local ORES_WHITELIST = { + [""minecraft:copper_ore""]=true, + [""minecraft:deepslate_copper_ore""]=true, + [""minecraft:gold_ore""]=true, + [""minecraft:deepslate_gold_ore""]=true, + [""minecraft:iron_ore""]=true, + [""minecraft:deepslate_iron_ore""]=true, + [""minecraft:coal_ore""]=true, + [""minecraft:deepslate_coal_ore""]=true, + [""minecraft:redstone_ore""]=true, + [""minecraft:deepslate_redstone_ore""]=true, + [""minecraft:emerald_ore""]=true, + [""minecraft:deepslate_emerald_ore""]=true, + [""minecraft:diamond_ore""]=true, + [""minecraft:deepslate_diamond_ore""]=true, + [""minecraft:lapis_ore""]=true, + [""minecraft:deepslate_lapis_ore""]=true, + [""minecraft:nether_gold_ore""]=true, + [""minecraft:nether_quartz_ore""]=true, + [""minecraft:ancient_debris""]=true, + [""ad_astra:moon_iron_ore""]=true, + [""ad_astra:moon_ice_shard_ore""]=true, + [""ad_astra:deepslate_ice_shard_ore""]=true, + [""ad_astra:moon_cheese_ore""]=true, + [""ad_astra:moon_desh_ore""]=true, + [""ad_astra:deepslate_desh_ore""]=true, + [""ad_astra:mars_iron_ore""]=true, + [""ad_astra:mars_diamond_ore""]=true, + [""ad_astra:mars_ostrum_ore""]=true, + [""ad_astra:deepslate_ostrum_ore""]=true, + [""ad_astra:mars_ice_shard_ore""]=true, + [""ad_astra:venus_coal_ore""]=true, + [""ad_astra:venus_gold_ore""]=true, + [""ad_astra:venus_diamond_ore""]=true, + [""ad_astra:venus_calorite_ore""]=true, + [""ad_astra:deepslate_calorite_ore""]=true, + [""ad_astra:mercury_iron_ore""]=true, + [""ad_astra:glacio_ice_shard_ore""]=true, + [""ad_astra:glacio_coal_ore""]=true, + [""ad_astra:glacio_copper_ore""]=true, + [""ad_astra:glacio_iron_ore""]=true, + [""ad_astra:glacio_lapis_ore""]=true, + [""create:zinc_ore""]=true, + [""create:deepslate_zinc_ore""]=true, + [""techreborn:bauxite_ore""]=true, + [""techreborn:deepslate_bauxite_ore""]=true, + [""techreborn:ruby_ore""]=true, + [""techreborn:deepslate_ruby_ore""]=true, + [""techreborn:sapphire_ore""]=true, + [""techreborn:deepslate_sapphire_ore""]=true, + [""techreborn:tin_ore""]=true, + [""techreborn:deepslate_tin_ore""]=true, + [""techreborn:cinnabar_ore""]=true, + [""techreborn:galena_ore""]=true, + [""techreborn:iridium_ore""]=true, + [""techreborn:pyrite_ore""]=true, + [""techreborn:lead_ore""]=true, + [""techreborn:periodot_ore""]=true, + [""techreborn:deepslate_periodot_ore""]=true, + [""techreborn:sheldonite_ore""]=true, + [""techreborn:deepslate_sheldonite_ore""]=true, + [""techreborn:silver_ore""]=true, + [""techreborn:deepslate_silver_ore""]=true, + [""techreborn:tungsten_ore""]=true, + [""techreborn:deepslate_tungsten_ore""]=true, + [""techreborn:sodalite_ore""]=true, + [""techreborn:sphalerite_ore""]=true +} + +-- Enum containing directions (Front, Back, Left, Right, Up, Down). +local Dir = { + Front = 0, + Back = 1, + Left = 2, + Right = 3, + Up = 4, + Down = 5 +} + +-- Declares the coal slot +local COAL_SLOT = 16 + +-- Declares the redstone position of the transmitter +local REDSTONE_TRANSMITTER = 'Back' + +-- Declares if the turtle is the right one or the left one +local TURTLE_SIDE = 'Left' + +-- Number of times the turtle moves forward and checks for ore veins (zero because it will be defined later) +local ITER = 0 + + + +-- ⚙️ Functions +-- ================================= + +-- Creates a table with depth and direction +local function vector(depth, dir) + return {depth=depth, dir=dir} +end + +-- Aligns the turtle and adds information to the track table +local function alignDir(dir, depth, track) + if (dir == Dir.Left) then + turtle.turnLeft() + table.insert(track, vector(depth, Dir.Left)) + elseif (dir == Dir.Right) then + turtle.turnRight() + table.insert(track, vector(depth, Dir.Right)) + elseif (dir == Dir.Back) then + turtle.turnRight() + turtle.turnRight() + table.insert(track, vector(depth, Dir.Right)) + table.insert(track, vector(depth, Dir.Right)) + end +end + +-- Undoes alignment based on the track table for the specified depth +local function undoAlignDir(depth, track) + while (#track > 0 and track[#track].depth == depth) do + local vec = table.remove(track) + if (vec.dir == Dir.Left) then + turtle.turnRight() + elseif (vec.dir == Dir.Right) then + turtle.turnLeft() + end + end +end + +-- Checks if the block is an ore based on the whitelist and reports rare ores +local function isMine(hasBlock, blockInfo) + return hasBlock and ORES_WHITELIST[blockInfo.name] +end + +-- Checks if the block in the given direction is mineable +local function inspectDirIsMine(dir) + local hasBlock, blockInfo + if (dir == Dir.Up) then + hasBlock, blockInfo = turtle.inspectUp() + elseif (dir == Dir.Down) then + hasBlock, blockInfo = turtle.inspectDown() + else + hasBlock, blockInfo = turtle.inspect() + end + + return isMine(hasBlock, blockInfo) +end + +-- Mines the block in the given direction, updates the turtle position, and adds information to the track table +local function excavateDir(dir, depth, track) + if (dir == Dir.Up) then + turtle.digUp() + turtle.up() + table.insert(track, vector(depth, Dir.Up)) + elseif (dir == Dir.Down) then + turtle.digDown() + turtle.down() + table.insert(track, vector(depth, Dir.Down)) + else + local counter = 0 + repeat + turtle.dig() + counter = counter + 1 + until turtle.forward() + table.insert(track, vector(depth, Dir.Front)) + end +end + +-- Selects the fill block from the turtle inventory +local function selectFillBlock() + for i = 1, 16 do + local info = turtle.getItemDetail(i) + if info and info.name == FILL_BLOCKS then + turtle.select(i) + return + end + end +end + +-- Moves the turtle back to the original position, filling the holes +local function backtrack(currentDepth, targetDepth, moveTrack, turnTrack) + while (currentDepth ~= targetDepth) do + while (#moveTrack > 0 and moveTrack[#moveTrack].depth == currentDepth - 1) do + local vec = table.remove(moveTrack) + if (vec.dir == Dir.Front) then + turtle.back() + selectFillBlock() + turtle.place() + elseif (vec.dir == Dir.Up) then + turtle.down() + selectFillBlock() + turtle.placeUp() + elseif (vec.dir == Dir.Down) then + turtle.up() + selectFillBlock() + turtle.placeDown() + end + end + undoAlignDir(currentDepth - 1, turnTrack) + currentDepth = currentDepth - 1 + end +end + +-- Starts the depth-first search for ore veins in the given direction +local function dfs(initDir) + local stack = {} + local turnTrack = {} + local moveTrack = {} + local depth = 0 + table.insert(stack, vector(depth, initDir)) + + while (#stack > 0) do + local vec = table.remove(stack) + backtrack(depth, vec.depth, moveTrack, turnTrack) + depth = vec.depth + + alignDir(vec.dir, depth, turnTrack) + + if (inspectDirIsMine(vec.dir)) then + excavateDir(vec.dir, depth, moveTrack) + depth = depth + 1 + + if isMine(turtle.inspect()) then + table.insert(stack, vector(depth, Dir.Front)) + end + + if isMine(turtle.inspectUp()) then + table.insert(stack, vector(depth, Dir.Up)) + end + if isMine(turtle.inspectDown()) then + table.insert(stack, vector(depth, Dir.Down)) + end + turtle.turnRight() + if isMine(turtle.inspect()) then + table.insert(stack, vector(depth, Dir.Right)) + end + turtle.turnRight() + if isMine(turtle.inspect()) then + table.insert(stack, vector(depth, Dir.Back)) + end + turtle.turnRight() + if isMine(turtle.inspect()) then + table.insert(stack, vector(depth, Dir.Left)) + end + turtle.turnRight() + else + undoAlignDir(depth, turnTrack) + end + end + + backtrack(depth, 0, moveTrack, turnTrack) +end + +-- Triggers the depth-first search if an ore block is found in the given direction +local function triggerDfs(dir) + if inspectDirIsMine(dir) then + dfs(dir) + end +end + +-- Checks for ore blocks around the turtle in all directions +local function inspectAround() + turtle.turnRight() + triggerDfs(Dir.Front) + + turtle.turnLeft() + triggerDfs(Dir.Up) + + turtle.turnLeft() + triggerDfs(Dir.Front) + + turtle.down() + triggerDfs(Dir.Front) + + turtle.turnRight() + triggerDfs(Dir.Down) + + turtle.turnRight() + triggerDfs(Dir.Front) + + turtle.turnLeft() + turtle.up() +end + +-- Digs one block ahead and breaks the block, and digs downwards +local function advance() + repeat + turtle.dig() + until turtle.forward() + turtle.digDown() +end + +-- Checks if it is in the initial poisition +local function isItTheInitialPosition() + hasBlockUp, blockInfoUp = turtle.inspectUp() + hasBlockDown, blockInfoDown = turtle.inspectDown() + if (blockInfo == 'reinfchest:gold_chest') and (blockInfoDown == 'minecraft:chest') then + INITIAL_POSITION = True + else + INITIAL_POSITION = False + end + return INITIAL_POSITION +end + +-- Refuel when bellow 50 fuel +local function refuel() + fuel_level = turtle.getFuelLevel() + if (fuel_level < 200) then + turtle.select(COAL_SLOT) + while (fuel_level < 600) do + fuel_level = turtle.getFuelLevel() + turtle.refuel() + end + end +end + +-- Checks coal amount in turtle inventory +local function checkCoalAmount() + turtle.select(COAL_SLOT) + coal_amount = turtle.getItemCount() + if (coal_amount < 64) then + coal_amount_to_get = 64 + return coal_amount_to_get + else + coal_amount_to_get = 0 + return coal_amount_to_get + end +end + +-- Grabs coal from chest bellow +local function suckCoalFromChest(coal_amount_to_get) + turtle.select(COAL_SLOT) + turtle.suckDown(coal_amount_to_get) +end + +-- Deposit the item in the chest above +local function depositsItems() + for i = 1, 15 do + turtle.select(i) + didItWork = turtle.dropUp() + if (didItWork == False) then + repeat + print(""Error, not able to deposit in chest (maybe it is full)!"") + didItWork = turtle.dropUp() + until (didItWork == True) + end + end +end + +-- Defines ITER value based on the turtle position +local function defineITER() + if (TURTLE_SIDE == 'Right') then + ITER = 31 + else + ITER = 27 + end +end + +-- Main function +INITIAL_POSITION = isItTheInitialPosition() +if (INITIAL_POSITION == True) then + + -- Get coal amount in the coal slot, if it less than a stack, it grabs more + coal_amount_to_get = checkCoalAmount() + while (coal_amount_to_get ~= 0) do + coal_amount_to_get = checkCoalAmount() + suckCoalFromChest(coal_amount_to_get) + refuel() + end + + -- Define ITER amount + defineITER() + print(ITER) + + -- Does the movement to get out of the Create machine and start mining + if (TURTLE_SIDE == 'Left') then + turtle.turnLeft() + turtle.forward() + else + turtle.turnRight() + hasBlock = turtle.inspect() + if (hasBlock == True) then + turtle.dig() + turtle.forward() + end + turtle.forward() + end + + -- Starts the mining + for i = 1, ITER do + advance() + inspectAround() + turtle.select(1) + turtle.placeDown() + refuel() + end + + -- Ends the mining and return to the starting point before starting mining + turtle.turnRight() + turtle.turnRight() + for i = 1, ITER do + turtle.forward() + end + + -- Returns to the initial position inside the create machine + if (TURTLE_SIDE == 'Left') then + turtle.forward() + turtle.turnLeft() + else + turtle.forward() + turtle.forward() + turtle.turnRight() + end + + -- Deposit items + depositsItems() + + -- Sends a redstone signal to the back of the turtle to trigger the create machine movement + redstone.setAnalogOutput(REDSTONE_TRANSMITTER,15) + os.sleep(1) + redstone.setAnalogOutput(REDSTONE_TRANSMITTER,0) + + -- End of program + +else +end" +rbUAvZpq,aoc 2023 day 1 part 1,Cazibear,Python,Saturday 9th of December 2023 03:16:32 PM CDT,"total = 0 + +with open(""day1.txt"") as f: # open the file, reading it + for line in f.readlines(): # loop over each line in the file + numbers = list(filter(str.isdigit, line)) # create a list of just the numbers in each line + calibration = int(numbers[0] + numbers[-1]) # add the first and last to get the calibration value + total += calibration # then add it to the total + +print(total)" +bVTjKGSH,AoC 2023 day 9 part 2 (dc),musifter,Bash,Saturday 9th of December 2023 03:13:35 PM CDT,"# Command: tr '-' '_' = MaxRestock then + plr.Character.Humanoid.WalkSpeed = 16 + plr.Character.Humanoid.JumpPower = 7.2 + + inStock = false + JobRemotes.ActivateClickDetector:FireClient(plr, Restaurant.Restaurant.ChoppingRestock.ClickDetector, true) + JobRemotes.ShowArrow:FireClient(plr, Restaurant.Restaurant.ChoppingRestock) + local connection0 + connection0 = Restaurant.Restaurant.ChoppingRestock.ClickDetector.MouseClick:Connect(function(player) + if plr ~= player then return end + + local Box = game.ReplicatedStorage.Tools[""Restaurant""].Box:Clone() + Box.Parent = player.Character + Box.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, 1) + + local Weld = Instance.new(""Weld"", Box) + Weld.Part0 = Box + Weld.Part1 = player.Character.HumanoidRootPart + Weld.C0 = Box.CFrame:Inverse() * player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, 2) + + local anim = game.ReplicatedStorage.Animations.HoldBox + Animations[plr][""Holding Box""] = player.Character.Humanoid.Animator:LoadAnimation(anim) + Animations[plr][""Holding Box""]:Play() + + JobRemotes.ShowArrow:FireClient(plr, Restaurant.Restaurant.RestockPlace) + + JobRemotes.ActivateClickDetector:FireClient(plr, Restaurant.Restaurant.RestockPlace.ClickDetector, true) + Restaurant.Restaurant.RestockPlace.CanQuery = true + + local connection2 + connection2 = Restaurant.Restaurant.RestockPlace.ClickDetector.MouseClick:Connect(function(player) + if plr.Character:FindFirstChild(""Box"") then + plr.Character:FindFirstChild(""Box""):Destroy() + Animations[plr][""Holding Box""]:Stop() + Animations[plr][""Holding Box""] = nil + end + inStock = true + JobRemotes.ShowArrow:FireClient(plr) + JobRemotes.ActivateClickDetector:FireClient(plr, Restaurant.Restaurant.RestockPlace.ClickDetector, false) + RoleStocks[plr] = 0 + connection2:Disconnect() + end) + table.insert(PlayerConnections[plr], connection2) + + connection0:Disconnect() + end) + table.insert(PlayerConnections[plr], connection0) + + repeat task.wait() + if connection0 == nil then + break + end + until inStock + end + + Restaurant.Restaurant.RestockPlace.CanQuery = false + plr.Character.Humanoid.WalkSpeed = 0 + plr.Character.Humanoid.JumpPower = 0 + plr.Character.HumanoidRootPart.CFrame = Restaurant.ChopperItems[""Stand""..station].CFrame * CFrame.new(0,1,0) + + local Board = Restaurant.ClickDetectors.Chopper[""Board""..station] + local Knife = Restaurant.ClickDetectors.Chopper[""Knife""..station] + + local BoardItem = Restaurant.ChopperItems[""Board""..station] + local KnifeItem = Restaurant.ChopperItems[""Knife""..station] + + local randomNum = math.random(1, 4) + + local food + local plate + if randomNum == 1 then + food = Restaurant.ChopperItems[""C"".. station] + plate = Restaurant.ClickDetectors.Chopper[""C"".. station] + elseif randomNum == 2 then + food = Restaurant.ChopperItems[""B"".. station] + plate = Restaurant.ClickDetectors.Chopper[""B"".. station] + elseif randomNum == 3 then + food = Restaurant.ChopperItems[""H"".. station] + plate = Restaurant.ClickDetectors.Chopper[""H"".. station] + elseif randomNum == 4 then + food = Restaurant.ChopperItems[""F"".. station] + plate = Restaurant.ClickDetectors.Chopper[""F"".. station] + end + + if food and plate then + JobRemotes.ShowArrow:FireClient(plr, Board) + + local connection + local connection2 + local connection3 + + -- Steps/Process + local clicks = { + first = false, + second = false, + third = false + } + + JobRemotes.ActivateClickDetector:FireClient(plr, Board.ClickDetector, true) + JobRemotes.ActivateClickDetector:FireClient(plr, plate.ClickDetector, true) + JobRemotes.ActivateClickDetector:FireClient(plr, Knife.ClickDetector, true) + + connection = Board.ClickDetector.MouseClick:Connect(function(player) + if player ~= plr then return end + + BoardItem.Transparency = 0 + JobRemotes.ShowArrow:FireClient(plr, plate) + + clicks.first = true + connection:Disconnect() + end) + + connection2 = plate.ClickDetector.MouseClick:Connect(function(player) + if player ~= plr then return end + if not clicks.first then return end + + changeModelTranparency(food, 0) + JobRemotes.ShowArrow:FireClient(plr, Knife) + + clicks.second = true + connection2:Disconnect() + end) + + connection3 = Knife.ClickDetector.MouseClick:Connect(function(player) + if player ~= plr then return end + if not clicks.second then return end + + changeTransparency(KnifeItem, 0, ""Part"") + + local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 3, true) + local tween = TweenService:Create(KnifeItem.PrimaryPart, tweenInfo, { + CFrame = (KnifeItem.PrimaryPart.CFrame * CFrame.Angles(math.rad(10), 0, 0)) * CFrame.new(-2, 0, 0) + }) + + local anim = game.ReplicatedStorage.Animations.Restaurant.Chopping + Animations[player][""Chopping Animation""] = player.Character.Humanoid.Animator:LoadAnimation(anim) + Animations[player][""Chopping Animation""]:Play() + + tween:Play() + + + tween.Completed:Wait() + Animations[player][""Chopping Animation""]:Stop() + Animations[player][""Chopping Animation""] = nil + + changeModelTranparency(KnifeItem, 1) + changeModelTranparency(food, 1) + BoardItem.Transparency = 1 + + RestaurantJob:Pay(plr) + RoleStocks[plr] += 1 + + ChopperAction(table.unpack(pack)) + + clicks.third = true + connection3:Disconnect() + end) + + table.insert(PlayerConnections[plr], connection) + table.insert(PlayerConnections[plr], connection2) + table.insert(PlayerConnections[plr], connection3) + end +end + +local MaxStock = 7 +function FlavorPickerAction(...) + local pack = table.pack(...) + local JobName = pack[1] + local EventName = pack[2] + local plr = pack[3] + local station = pack[4] + if not HasJob(plr) then return end + + local inStock = true + + JobRemotes.FlavorsTransparency:FireClient(plr, IceCream[""Ice cream shop""].Flavs.Flavors:GetChildren(), RoleStocks[plr] / MaxStock) + + JobRemotes.ActivateClickDetector:FireClient(plr, IceCream.ClickDetectors.IceCreamStock.ClickDetector, false) + + if RoleStocks[plr] == MaxStock then + inStock = false + print(""I am here"") + JobRemotes.HighlightItem:FireClient(plr, IceCream.ClickDetectors.Boxes) + JobRemotes.ShowArrow:FireClient(plr, IceCream.ClickDetectors.Boxes) + local connection + JobRemotes.ActivateClickDetector:FireClient(plr, IceCream.ClickDetectors.Boxes.ClickDetector, true) + connection = IceCream.ClickDetectors.Boxes.ClickDetector.MouseClick:Connect(function(player) + if player ~= player then return end + + local boxDist = 1 + + local Box = game.ReplicatedStorage.Tools[""Ice Cream""].Box:Clone() + Box.Parent = player.Character + Box.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, boxDist) + + local Weld = Instance.new(""Weld"", Box) + Weld.Part0 = Box + Weld.Part1 = player.Character.HumanoidRootPart + Weld.C0 = Box.CFrame:Inverse() * player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, boxDist) + + local anim = game.ReplicatedStorage.Animations.HoldBox + Animations[plr][""Holding Box""] = player.Character.Humanoid.Animator:LoadAnimation(anim) + Animations[plr][""Holding Box""]:Play() + + JobRemotes.HighlightItem:FireClient(plr, IceCream.ClickDetectors.IceCreamStock) + JobRemotes.ShowArrow:FireClient(plr, IceCream.ClickDetectors.IceCreamStock) + JobRemotes.ActivateClickDetector:FireClient(plr, IceCream.ClickDetectors.IceCreamStock.ClickDetector, true) + + local connection2 + connection2 = IceCream.ClickDetectors.IceCreamStock.ClickDetector.MouseClick:Connect(function(player) + if plr.Character:FindFirstChild(""Box"") then + plr.Character:FindFirstChild(""Box""):Destroy() + Animations[plr][""Holding Box""]:Stop() + Animations[plr][""Holding Box""] = nil + end + JobRemotes.ActivateClickDetector:FireClient(plr, IceCream.ClickDetectors.IceCreamStock.ClickDetector, false) + inStock = true + JobRemotes.HighlightItem:FireClient(plr) + JobRemotes.ShowArrow:FireClient(plr) + + RoleStocks[plr] = 0 + connection2:Disconnect() + end) + table.insert(PlayerConnections[plr], connection2) + + connection:Disconnect() + end) + + table.insert(PlayerConnections[plr], connection) + + repeat task.wait() + if connection == nil then + break + end + until inStock + end + + + if inStock == true then + JobRemotes.FlavorsTransparency:FireClient(plr, IceCream[""Ice cream shop""].Flavs.Flavors:GetChildren(), RoleStocks[plr] / MaxStock) + + + local CustomerModels = game.ReplicatedStorage.Customers:GetChildren() + local Customer = CustomerModels[math.random(1, #CustomerModels)]:Clone() + Customer.Parent = workspace.JobSystem.PlayerCustomers + + for i, v: BasePart in pairs(Customer:GetDescendants()) do + if v:IsA(""BasePart"") then + v.CollisionGroup = ""Customers"" + end + end + + local Host = Instance.new(""ObjectValue"", Customer) + Host.Name = ""Host"" + Host.Value = plr + + local Humanoid: Humanoid = Customer.Humanoid + + local Waypoints = IceCream.Waypoints.FlavorPicker[""FP""..station] + + Customer.HumanoidRootPart.CFrame = Waypoints:FindFirstChild(""1"").CFrame + CreatePath(Customer, Waypoints:FindFirstChild(""5"").Position) + + local suffix = ListOfCustomerMsgs.Suffix[JobName][math.random(1, #ListOfCustomerMsgs.Suffix[JobName])] + + local CustomerTag = script.CustomerTag:Clone() + CustomerTag.Parent = Customer.Head + + CustomerTag.Frame.Icon.Image = suffix.Icon + + for i = 1, #IceCream.ClickDetectors.FlavorPicker:GetChildren() do + local flavor = IceCream.ClickDetectors.FlavorPicker:FindFirstChild(i) + + if flavor then + local connection + JobRemotes.ActivateClickDetector:FireClient(plr, flavor.ClickDetector, true) + connection = flavor.ClickDetector.MouseClick:Connect(function(player) + if player ~= plr then return end + + local PHum = plr.Character:WaitForChild(""Humanoid"") + + local Animation = game:GetService(""ReplicatedStorage"").Animations[""Ice Cream""].Picking + local PlayAni = PHum:WaitForChild(""Animator""):LoadAnimation(Animation) + PlayAni:Play() + + connection:Disconnect() + CustomerTag:Destroy() + + if tonumber(i) == tonumber(suffix.Order) then + if Customer:FindFirstChild(""Head"") == nil then return end + ChatService:Chat(Customer:WaitForChild(""Head""), ""Thanks for the Ice Cream 🍦!!"", Enum.ChatColor.White) + IceCreamJob:Pay(plr) + + task.wait(1) + Customer:Destroy() + print(""Customer Destroyed1"") + + coroutine.wrap(function() + FlavorPickerAction(table.unpack(pack)) + end)() + else + if Customer:FindFirstChild(""Head"") == nil then return end + ChatService:Chat(Customer:WaitForChild(""Head""), ""Ugh, you got my order wrong!!"", Enum.ChatColor.White) + + task.wait(1) + Customer:Destroy() + print(""Customer Destroyed2"") + + coroutine.wrap(function() + FlavorPickerAction(table.unpack(pack)) + end)() + end + RoleStocks[plr] += 1--ERRRRROOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORRRRRRRRRRRRR + end) + + table.insert(PlayerConnections[plr], connection) + end + end + end +end + +local MaxStock = 7 +function ToppingsPickerAction(...) + print('Toppings') + local pack = table.pack(...) + local JobName = pack[1] + local EventName = pack[2] + local plr = pack[3] + local station = pack[4] + if not HasJob(plr) then return end + + JobRemotes.ActivateClickDetector:FireClient(plr, IceCream.ClickDetectors.ToppingsStock.ClickDetector, false) + + local inStock = true + + if RoleStocks[plr] >= MaxStock then + inStock = false + JobRemotes.ActivateClickDetector:FireClient(plr, IceCream.ClickDetectors.Toppings.ClickDetector, true) + JobRemotes.ShowArrow:FireClient(plr, IceCream.ClickDetectors.Toppings) + local connection + connection = IceCream.ClickDetectors.Toppings.ClickDetector.MouseClick:Connect(function(player) + if player ~= plr then return end + + local PHum = plr.Character:WaitForChild(""Humanoid"") + + local Animation = game:GetService(""ReplicatedStorage"").Animations[""Ice Cream""].Picking + local PlayAni = PHum:WaitForChild(""Animator""):LoadAnimation(Animation) + PlayAni:Play() + + local boxDist = 1 + + local Box = game.ReplicatedStorage.Tools[""Ice Cream""].Box:Clone() + Box.Parent = player.Character + Box.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, boxDist) + + local Weld = Instance.new(""Weld"", Box) + Weld.Part0 = Box + Weld.Part1 = player.Character.HumanoidRootPart + Weld.C0 = Box.CFrame:Inverse() * player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, boxDist) + + local anim = game.ReplicatedStorage.Animations.HoldBox + Animations[plr][""Holding Box""] = player.Character.Humanoid.Animator:LoadAnimation(anim) + Animations[plr][""Holding Box""]:Play() + + JobRemotes.ShowArrow:FireClient(plr, IceCream.ClickDetectors.ToppingsStock) + + JobRemotes.ActivateClickDetector:FireClient(plr, IceCream.ClickDetectors.ToppingsStock.ClickDetector, true) + + local connection2 + connection2 = IceCream.ClickDetectors.ToppingsStock.ClickDetector.MouseClick:Connect(function(player) + if plr.Character:FindFirstChild(""Box"") then + plr.Character:FindFirstChild(""Box""):Destroy() + Animations[plr][""Holding Box""]:Stop() + Animations[plr][""Holding Box""] = nil + end + inStock = true + JobRemotes.ShowArrow:FireClient(plr) + JobRemotes.ActivateClickDetector:FireClient(plr, IceCream.ClickDetectors.ToppingsStock.ClickDetector, false) + RoleStocks[plr] = 0 + connection2:Disconnect() + end) + table.insert(PlayerConnections[plr], connection2) + + connection:Disconnect() + end) + table.insert(PlayerConnections[plr], connection) + + repeat task.wait() + if connection == nil then + break + end + until inStock + end + + if inStock == true then + print(inStock) + print(RoleStocks[plr]) + local Customer: Model = game.ReplicatedStorage.Customers:GetChildren() + Customer = Customer[math.random(1, #Customer)]:Clone() + Customer.Parent = workspace.JobSystem.PlayerCustomers + + for i, v: BasePart in pairs(Customer:GetDescendants()) do + if v:IsA(""BasePart"") then + v.CollisionGroup = ""Customers"" + end + end + + local Host = Instance.new(""ObjectValue"", Customer) + Host.Name = ""Host"" + Host.Value = plr + + local Humanoid: Humanoid = Customer.Humanoid + + local Waypoints = IceCream.Waypoints.ToppingsPicker[""TP""..station] + + Customer.HumanoidRootPart.CFrame = Waypoints:FindFirstChild(""1"").CFrame + CreatePath(Customer, Waypoints:FindFirstChild(""5"").Position) + + + local num = math.random(1, #ListOfCustomerMsgs.Suffix[JobName]) + local suffix = ListOfCustomerMsgs.Suffix[JobName][num] + local Order = Orders.Clone(Orders.IceCream.Order[num]) + + local CustomerTag = script.CustomerTag:Clone() + CustomerTag.Parent = Customer:WaitForChild('Head') + + CustomerTag.Frame.Icon.Image = suffix.Icon + + local isRunning = true + local isOnNumber = 1 + local NameOfStage = """" + + for i, v in pairs(IceCream.ClickDetectors.ToppingsPicker:GetChildren()) do + local isCorrect = false -- whether it is on the recipe + for j, k in pairs(Order.Clicks) do + if k.Name == v.Name then + isCorrect = true + end + end + + if not isCorrect then + local connection + JobRemotes.ActivateClickDetector:FireClient(plr, v.ClickDetector, true) + connection = v.ClickDetector.MouseClick:Connect(function(player) + if player ~= plr then return end + if Customer:FindFirstChild('Head') == nil then + return + end + + CustomerTag:Destroy() + ChatService:Chat(Customer:WaitForChild('Head'), ""Ugh, you got my order wrong!!"", Enum.ChatColor.White) + connection:Disconnect() + task.wait(1) + Customer:Destroy() + + isRunning = false + + RoleStocks[plr] += 1 + ToppingsPickerAction(table.unpack(pack)) + end) + table.insert(PlayerConnections[plr], connection) + end + end + + for i = 1, #Order.Clicks, 1 do + local Stage = Order.Clicks[i] + local v = IceCream.ClickDetectors.ToppingsPicker[Stage.Name] + local connection + + if i == 1 then + JobRemotes.ShowArrow:FireClient(plr, v) + end + JobRemotes.ActivateClickDetector:FireClient(plr, v.ClickDetector, true) + connection = v.ClickDetector.MouseClick:Connect(function(player) + if player ~= plr then return end + + if i ~= 1 then + local clminus = Order.Clicks[i - 1] -- Current one minus 1 (to go back) + if clminus then + if not clminus.Done then + isRunning = false + ToppingsPickerAction(table.unpack(pack)) + connection:Disconnect() + return + end + end + end + + connection:Disconnect() + + isOnNumber += 1 + if i ~= #Order.Clicks then + NameOfStage = Order.Clicks[i+1].Name + end + print(i) + if i == #Order.Clicks then + JobRemotes.ShowArrow:FireClient(plr) + isRunning = false + RoleStocks[plr] += 1 + CustomerTag:Destroy() + IceCreamJob:Pay(plr) + if Customer:FindFirstChild('Head') ~= nil then + ChatService:Chat(Customer.Head, ""Thanks for the Ice Cream 🍦!!"", Enum.ChatColor.White) + end + + task.wait(1) + Customer:Destroy() + ToppingsPickerAction(table.unpack(pack)) + end + Order.Clicks[i].Done = true + end) + table.insert(PlayerConnections[plr], connection) + end + + coroutine.wrap(function() + while isRunning do + if #PlayerConnections[plr] == 0 then + break + end + + if isOnNumber ~= 1 then + JobRemotes.ShowArrow:FireClient(plr, IceCream.ClickDetectors.ToppingsPicker[NameOfStage]) + end + task.wait() + end + RoleStocks[plr] += 1 + end)() + end +end + +function QuitJob(...) + local pack = table.pack(...) + local JobName = pack[1] + local EventName = pack[2] + local plr = pack[3] + if not HasJob(plr) then return end + + JobRemotes.FlavorsTransparency:FireClient(plr, IceCream[""Ice cream shop""].Flavs.Flavors:GetChildren(), 0) + + local pay = 0 + local memo = """" + + if JobName == HallaPizzaJob.JobName then + -- Paycheck + pay = HallaPizzaJob:GetPlayerPay(plr) + memo = ""HP WORKER"" + + HallaPizzaJob.RemoveWorker(plr) + local Registers = HallaPizza.Registers + + -- Reset Registers if they are a Cashier + if Registers.Register1.Owner.Value == plr then + Registers.Register1.Owner.Value = nil + elseif Registers.Register2.Owner.Value == plr then + Registers.Register2.Owner.Value = nil + end + + local DM = HallaPizza.ObjectValues.DoughMaker -- Dough Maker Object Values + local DMC = HallaPizza.ClickDetectors.DoughMaker -- Dough Maker ClickDetectors + + if DM.Table1.Host.Value == plr then + DM.Table1.Host.Value = nil + JobRemotes.ActivateClickDetector:FireClient(plr, DMC.Table1.ClickDetector, false) + elseif DM.Table2.Host.Value == plr then + DM.Table2.Host.Value = nil + JobRemotes.ActivateClickDetector:FireClient(plr, DMC.Table2.ClickDetector, false) + end + + local PM = HallaPizza.ObjectValues.PizzaMaker -- Pizza Maker Object Values + local PMC = HallaPizza.ClickDetectors.PizzaMaker -- Pizza Maker ClickDetectors + local PMI = HallaPizza.PizzaMakerItems + + if PM.Table1.Host.Value == plr then + PM.Table1.Host.Value = nil + PM.Screen1.Value.GUI.Icon.Image = """" + JobRemotes.ActivateClickDetector:FireClient(plr, PMC.Table1.ClickDetector, false) + changeModelTranparency(PMI.Pizza1, 1) + elseif PM.Table2.Host.Value == plr then + PM.Table2.Host.Value = nil + PM.Screen2.Value.GUI.Icon.Image = """" + JobRemotes.ActivateClickDetector:FireClient(plr, PMC.Table2.ClickDetector, false) + changeModelTranparency(PMI.Pizza2, 1) + end + + -- Reset Player Worker Count + local workers = HallaPizzaJob:GetRoleTotalWorkers(""Cashier"") + local maxWorkers = HallaPizzaJob:GetRoleMaxWorkers(""Cashier"") + HallaPizza.ClaimParts.CashRegister.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + workers = HallaPizzaJob:GetRoleTotalWorkers(""Pizza Runner"") + maxWorkers = HallaPizzaJob:GetRoleMaxWorkers(""Pizza Runner"") + HallaPizza.ClaimParts.PizzaRunner.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + local workers = HallaPizzaJob:GetRoleTotalWorkers(""Dough Maker"") + local maxWorkers = HallaPizzaJob:GetRoleMaxWorkers(""Dough Maker"") + HallaPizza.ClaimParts.DoughMaker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + local workers = HallaPizzaJob:GetRoleTotalWorkers(""Pizza Maker"") + local maxWorkers = HallaPizzaJob:GetRoleMaxWorkers(""Pizza Maker"") + HallaPizza.ClaimParts.PizzaMaker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + elseif JobName == RestaurantJob.JobName then + -- Paycheck + pay = RestaurantJob:GetPlayerPay(plr) + memo = ""Restaurant Worker"" + + RestaurantJob.RemoveWorker(plr) + + -- Reset Player Worker Count + local workers = RestaurantJob:GetRoleTotalWorkers(""Cashier"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Cashier"") + Restaurant.ClaimParts.CashRegister.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + -- Reset Player Worker Count + local workers = RestaurantJob:GetRoleTotalWorkers(""Delivery"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Delivery"") + Restaurant.ClaimParts.Delivery.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + -- Reset Player Worker Count + local workers = RestaurantJob:GetRoleTotalWorkers(""Dish Washer"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Dish Washer"") + Restaurant.ClaimParts.DishWasher.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + -- Reset Player Worker Count + local workers = RestaurantJob:GetRoleTotalWorkers(""Cooker"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Cooker"") + Restaurant.ClaimParts.Cooker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + -- Reset Player Worker Count + local workers = RestaurantJob:GetRoleTotalWorkers(""Chopper"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Chopper"") + Restaurant.ClaimParts.Chopper.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + elseif JobName == IceCreamJob.JobName then + -- Paycheck + pay = IceCreamJob:GetPlayerPay(plr) + memo = ""Ice Cream Worker"" + + IceCreamJob.RemoveWorker(plr) + + -- Reset Player Worker Count + local workers = IceCreamJob:GetRoleTotalWorkers(""Flavor Picker"") + local maxWorkers = IceCreamJob:GetRoleMaxWorkers(""Flavor Picker"") + IceCream.ClaimParts.FlavorPicker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + -- Reset Player Worker Count + local workers = IceCreamJob:GetRoleTotalWorkers(""Toppings Picker"") + local maxWorkers = IceCreamJob:GetRoleMaxWorkers(""Toppings Picker"") + IceCream.ClaimParts.ToppingsPicker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + -- Reset Player Worker Count + local workers = IceCreamJob:GetRoleTotalWorkers(""Cashier"") + local maxWorkers = IceCreamJob:GetRoleMaxWorkers(""Cashier"") + IceCream.ClaimParts.CashRegister.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + end + for i, v:ProximityPrompt in pairs(workspace.JobSystem[JobName].ClaimParts:GetDescendants()) do + if v:IsA(""ProximityPrompt"") then + JobRemotes.ActivatePrompt:FireClient(plr, v, true) + end + end + local CanReceivePay = true + if pay > 0 then + JobRemotes.ShowPaycheck:FireClient(plr, pay, memo) + JobRemotes.GivePaycheck.OnServerEvent:Connect(function(player) + if CanReceivePay == true then + CanReceivePay = false + player.leaderstats:FindFirstChild(""Hallabucks"").Value += pay + end + + end) + end + + -- Disconnect all RBX Events + for i, v in pairs(PlayerConnections[plr]) do + v:Disconnect() + PlayerConnections[plr][i] = nil + end + + RoleStocks[plr] = 0 + + -- Destroy all Player Customers owned by this player + for i, v in pairs(workspace.JobSystem.PlayerCustomers:GetChildren()) do + if v:FindFirstChild(""Host"") then + if v:FindFirstChild(""Host"").Value == plr then + v:Destroy() + end + end + end + + -- Stop showing an arrow + JobRemotes.ShowArrow:FireClient(plr) + + plr.PlayerGui.CashierGui.Adornee = nil + plr.PlayerGui.CashierGui2.Adornee = nil + + if plr.Character:FindFirstChild(""Box"") then + plr.Character:FindFirstChild(""Box""):Destroy() + Animations[plr][""Holding Box""]:Stop() + Animations[plr][""Holding Box""] = nil + end + + for i, v in pairs(workspace.JobSystem:GetDescendants()) do + if v:IsA(""ClickDetector"") then + JobRemotes.ActivateClickDetector:FireClient(plr, v, false) + end + end + + plr.Character.Humanoid.WalkSpeed = game.StarterPlayer.CharacterWalkSpeed + plr.Character.Humanoid.JumpPower = game.StarterPlayer.CharacterJumpPower + + JobRemotes.ShowFrames:FireClient(plr, false) + + if plr.Character:FindFirstChildWhichIsA(""Folder"") then + task.spawn(function() + plr.Character:FindFirstChildWhichIsA(""Folder""):Destroy() + end) + end +end + +-- Create Events +-- HallaPizza +HallaPizzaJob:CreateEvent(""StartJob"", StartJob) +HallaPizzaJob:CreateEvent(""QuitJob"", QuitJob) +HallaPizzaJob:CreateRoleAction(""Cashier"", ""Cashier Customer"", CashierCustomerAction) +HallaPizzaJob:CreateRoleAction(""Pizza Runner"", ""PR Customer"", CustomerAction2) +HallaPizzaJob:CreateRoleAction(""Dough Maker"", ""Dough Maker Action"", DoughMakerAction) +HallaPizzaJob:CreateRoleAction(""Pizza Maker"", ""Pizza Maker Action"", PizzaMakerAction) + +-- Restaurant +RestaurantJob:CreateEvent(""StartJob"", StartJob) +--RestaurantJob:CreateEvent(""ChangeRole"", ChangeRole) +RestaurantJob:CreateEvent(""QuitJob"", QuitJob) +RestaurantJob:CreateRoleAction(""Cashier"", ""Cashier Customer"", CashierCustomerAction) +RestaurantJob:CreateRoleAction(""Delivery"", ""CustomerAction2"", CustomerAction2) +RestaurantJob:CreateRoleAction(""Dish Washer"", ""Dish Washer Action"", DishWasherAction) +RestaurantJob:CreateRoleAction(""Cooker"", ""Cooker Action"", CookerAction) +RestaurantJob:CreateRoleAction(""Chopper"", ""Chopper Action"", ChopperAction) + + +-- Ice Cream +IceCreamJob:CreateEvent(""StartJob"", StartJob) +--IceCreamJob:CreateEvent(""ChangeRole"", ChangeRole) +IceCreamJob:CreateEvent(""QuitJob"", QuitJob) +IceCreamJob:CreateRoleAction(""Cashier"", ""Cashier Customer"", CashierCustomerAction) +IceCreamJob:CreateRoleAction(""Flavor Picker"", ""Flavor Picker Action"", FlavorPickerAction) +IceCreamJob:CreateRoleAction(""Toppings Picker"", ""Toppings Picker Action"", ToppingsPickerAction) + +--------------------------------------------------------------- +-- Prompt Events +--------------------------------------------------------------- + +---------------------- HallaPizza ----------------------------- + +HallaPizza.EndShift.Touched:Connect(function(hit) + local player = game.Players:GetPlayerFromCharacter(hit.Parent) + if player then + HallaPizzaJob:FireEvent(""QuitJob"", player) + end +end) + +-- Cashier ----------------------------------------------------- + +local Registers = HallaPizza.Registers +HallaPizza.ClaimParts.CashRegister.ProximityPrompt.Triggered:Connect(function(player) + HallaPizzaJob:FireEvent(""StartJob"", player, ""Cashier"") + if Registers.Register1.Owner.Value == nil then + Registers.Register1.Owner.Value = player + elseif Registers.Register2.Owner.Value == nil then + Registers.Register2.Owner.Value = player + end + local workers = HallaPizzaJob:GetRoleTotalWorkers(""Cashier"") + local maxWorkers = HallaPizzaJob:GetRoleMaxWorkers(""Cashier"") + HallaPizza.ClaimParts.CashRegister.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + HallaPizzaJob:FireRoleAction(""Cashier"", ""Cashier Customer"", player) +end) + +-- Pizza Runner ----------------------------------------------- + +HallaPizza.ClaimParts.PizzaRunner.ProximityPrompt.Triggered:Connect(function(player) + HallaPizzaJob:FireEvent(""StartJob"", player, ""Pizza Runner"") + + local workers = HallaPizzaJob:GetRoleTotalWorkers(""Pizza Runner"") + local maxWorkers = HallaPizzaJob:GetRoleMaxWorkers(""Pizza Runner"") + HallaPizza.ClaimParts.PizzaRunner.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + HallaPizzaJob:FireRoleAction(""Pizza Runner"", ""PR Customer"", player) +end) + + +-- Dough Maker ----------------------------------------------- + +HallaPizza.ClaimParts.DoughMaker.ProximityPrompt.Triggered:Connect(function(player) + HallaPizzaJob:FireEvent(""StartJob"", player, ""Dough Maker"") + + local workers = HallaPizzaJob:GetRoleTotalWorkers(""Dough Maker"") + local maxWorkers = HallaPizzaJob:GetRoleMaxWorkers(""Dough Maker"") + HallaPizza.ClaimParts.DoughMaker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + local DM = HallaPizza.ObjectValues.DoughMaker -- Dough Maker Object Values + if DM.Table1.Host.Value ~= nil then + DM.Table1.Host.Value = player + elseif DM.Table2.Host.Value ~= nil then + DM.Table2.Host.Value = player + end + + HallaPizzaJob:FireRoleAction(""Dough Maker"", ""Dough Maker Action"", player, HallaPizzaJob:GetRoleTotalWorkers(""Dough Maker"")) +end) + +-- Pizza Maker ----------------------------------------------- + +HallaPizza.ClaimParts.PizzaMaker.ProximityPrompt.Triggered:Connect(function(player) + HallaPizzaJob:FireEvent(""StartJob"", player, ""Pizza Maker"") + + local workers = HallaPizzaJob:GetRoleTotalWorkers(""Pizza Maker"") + local maxWorkers = HallaPizzaJob:GetRoleMaxWorkers(""Pizza Maker"") + HallaPizza.ClaimParts.PizzaMaker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + local PM = HallaPizza.ObjectValues.PizzaMaker -- Dough Maker Object Values + if PM.Table1.Host.Value == nil then + PM.Table1.Host.Value = player + elseif PM.Table2.Host.Value == nil then + PM.Table2.Host.Value = player + end + + HallaPizzaJob:FireRoleAction(""Pizza Maker"", ""Pizza Maker Action"", player, HallaPizzaJob:GetRoleTotalWorkers(""Pizza Maker"")) +end) + +---------------------- Restaurant ----------------------------- + +Restaurant.EndShift.Touched:Connect(function(hit) + local player = game.Players:GetPlayerFromCharacter(hit.Parent) + if player then + RestaurantJob:FireEvent(""QuitJob"", player) + end +end) + +-- Cashier ----------------------------------------------------- + +local Registers = Restaurant.Registers +Restaurant.ClaimParts.CashRegister.ProximityPrompt.Triggered:Connect(function(player) + RestaurantJob:FireEvent(""StartJob"", player, ""Cashier"") + if Registers.Register1.Owner.Value == nil then + Registers.Register1.Owner.Value = player + elseif Registers.Register2.Owner.Value == nil then + Registers.Register2.Owner.Value = player + end + local workers = RestaurantJob:GetRoleTotalWorkers(""Cashier"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Cashier"") + Restaurant.ClaimParts.CashRegister.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + RestaurantJob:FireRoleAction(""Cashier"", ""Cashier Customer"", player) +end) + +-- Delivery ----------------------------------------------- + +Restaurant.ClaimParts.Delivery.ProximityPrompt.Triggered:Connect(function(player) + RestaurantJob:FireEvent(""StartJob"", player, ""Delivery"") + + local workers = RestaurantJob:GetRoleTotalWorkers(""Delivery"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Delivery"") + Restaurant.ClaimParts.Delivery.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + RestaurantJob:FireRoleAction(""Delivery"", ""CustomerAction2"", player) +end) + +-- Dish Washer ----------------------------------------------- + +Restaurant.ClaimParts.DishWasher.ProximityPrompt.Triggered:Connect(function(player) + RestaurantJob:FireEvent(""StartJob"", player, ""Dish Washer"") + + local workers = RestaurantJob:GetRoleTotalWorkers(""Dish Washer"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Dish Washer"") + Restaurant.ClaimParts.DishWasher.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + RestaurantJob:FireRoleAction(""Dish Washer"", ""Dish Washer Action"", player, RestaurantJob:GetRoleTotalWorkers(""Dish Washer"")) +end) + +-- Cooker ----------------------------------------------- + + +Restaurant.ClaimParts.Cooker.ProximityPrompt.Triggered:Connect(function(player) + RestaurantJob:FireEvent(""StartJob"", player, ""Cooker"") + + local workers = RestaurantJob:GetRoleTotalWorkers(""Cooker"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Cooker"") + Restaurant.ClaimParts.Cooker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + RestaurantJob:FireRoleAction(""Cooker"", ""Cooker Action"", player) +end) + +-- Chopper ----------------------------------------------- + +Restaurant.ClaimParts.Chopper.ProximityPrompt.Triggered:Connect(function(player) + RestaurantJob:FireEvent(""StartJob"", player, ""Chopper"") + + local workers = RestaurantJob:GetRoleTotalWorkers(""Chopper"") + local maxWorkers = RestaurantJob:GetRoleMaxWorkers(""Chopper"") + Restaurant.ClaimParts.Chopper.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + + RestaurantJob:FireRoleAction(""Chopper"", ""Chopper Action"", player, RestaurantJob:GetRoleTotalWorkers(""Chopper"")) +end) + +---------------------- Ice Cream Shop ----------------------------- + +IceCream.EndShift.Touched:Connect(function(hit) + local player = game.Players:GetPlayerFromCharacter(hit.Parent) + if player then + IceCreamJob:FireEvent(""QuitJob"", player) + end +end) + +-- Cashier ----------------------------------------------------- + +local Registers = IceCream.Registers +IceCream.ClaimParts.CashRegister.ProximityPrompt.Triggered:Connect(function(player) + IceCreamJob:FireEvent(""StartJob"", player, ""Cashier"") + if Registers.Register1.Owner.Value == nil then + Registers.Register1.Owner.Value = player + elseif Registers.Register2.Owner.Value == nil then + Registers.Register2.Owner.Value = player + end + local workers = IceCreamJob:GetRoleTotalWorkers(""Cashier"") + local maxWorkers = IceCreamJob:GetRoleMaxWorkers(""Cashier"") + IceCream.ClaimParts.CashRegister.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + IceCreamJob:FireRoleAction(""Cashier"", ""Cashier Customer"", player) +end) + +IceCream.ClaimParts.FlavorPicker.ProximityPrompt.Triggered:Connect(function(player) + IceCreamJob:FireEvent(""StartJob"", player, ""Flavor Picker"") + + local workers = IceCreamJob:GetRoleTotalWorkers(""Flavor Picker"") + local maxWorkers = IceCreamJob:GetRoleMaxWorkers(""Flavor Picker"") + IceCream.ClaimParts.FlavorPicker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + IceCreamJob:FireRoleAction(""Flavor Picker"", ""Flavor Picker Action"", player, IceCreamJob:GetRoleTotalWorkers(""Flavor Picker"")) +end) + +IceCream.ClaimParts.ToppingsPicker.ProximityPrompt.Triggered:Connect(function(player) + IceCreamJob:FireEvent(""StartJob"", player, ""Toppings Picker"") + + local workers = IceCreamJob:GetRoleTotalWorkers(""Toppings Picker"") + local maxWorkers = IceCreamJob:GetRoleMaxWorkers(""Toppings Picker"") + IceCream.ClaimParts.ToppingsPicker.BillboardGui.TextLabel.Text = workers .. ""/"" .. maxWorkers + IceCreamJob:FireRoleAction(""Toppings Picker"", ""Toppings Picker Action"", player, IceCreamJob:GetRoleTotalWorkers(""Toppings Picker"")) +end) + +--------------------------------------------------------------- +-- ClickDetector Events +--------------------------------------------------------------- + +for i, v in pairs(HallaPizza.ClickDetectors.Pizza:GetChildren()) do + if v:IsA(""BasePart"") then + local clickDetector: ClickDetector = v:FindFirstChild(""ClickDetector"") + + if clickDetector then + clickDetector.MouseClick:Connect(function(player) + if HallaPizzaJob:IsRoleWorker(""Pizza Runner"", player) then + local tool = game.ReplicatedStorage.Tools.HallaPizza.Pizza:FindFirstChild(v.Name) + local anim = game.ReplicatedStorage.Animations.HallaPizza.HoldPizza + + if tool and anim then + tool = tool:Clone() + tool.Parent = player.Character + + tool.Handle.CFrame *= CFrame.new(0, 0, 2) + + local Weld = Instance.new(""Weld"", tool.Handle) + Weld.Part0 = tool.Handle + Weld.Part1 = player.Character.RightHand + Weld.C0 = tool.Handle.CFrame:Inverse() * player.Character.RightHand.CFrame * CFrame.Angles(math.rad(180), 0, 0) + + Animations[player][""Holding Pizza""] = player.Character.Humanoid.Animator:LoadAnimation(anim) + Animations[player][""Holding Pizza""]:Play() + end + end + end) + end + end +end + +for i, v in pairs(Restaurant.ClickDetectors.Meals:GetChildren()) do + if v:IsA(""BasePart"") then + local clickDetector: ClickDetector = v:FindFirstChild(""ClickDetector"") + + if clickDetector then + clickDetector.MouseClick:Connect(function(player) + if RestaurantJob:IsRoleWorker(""Delivery"", player) then + local tool = game.ReplicatedStorage.Tools.Restaurant.Meals:FindFirstChild(v.Name) + print(v.Name) + print(tool) + local anim = game.ReplicatedStorage.Animations.Restaurant.HoldMeal + + if tool and anim then + tool = tool:Clone() + tool.Parent = player.Character + tool.Handle.CFrame *= CFrame.new(0, 0, 2) + + local Weld = Instance.new(""Weld"", tool.Handle) + Weld.Part0 = tool.Handle + Weld.Part1 = player.Character.RightHand + Weld.C0 = tool.Handle.CFrame:Inverse() * player.Character.RightHand.CFrame * CFrame.Angles(math.rad(30), 0, 0) * CFrame.new(0, 0.5, 1) + + Animations[player][""Holding Plate""] = player.Character.Humanoid.Animator:LoadAnimation(anim) + Animations[player][""Holding Plate""]:Play() + end + end + end) + end + end +end + +JobRemotes.QuitJob.OnServerEvent:Connect(function(player) + if HallaPizzaJob:IsWorker(player) then + HallaPizzaJob:FireEvent(""QuitJob"", player) + end + if RestaurantJob:IsWorker(player) then + RestaurantJob:FireEvent(""QuitJob"", player) + end + if IceCreamJob:IsWorker(player) then + IceCreamJob:FireEvent(""QuitJob"", player) + end +end) + +game[""Run Service""].Heartbeat:Connect(function() + game[""Run Service""].Heartbeat:Wait() + for i, v in pairs(game.Players:GetChildren()) do + local player = v + local Pay = 0 + local IsWorker = false + if HallaPizzaJob:IsWorker(player) then + Pay = HallaPizzaJob:GetPlayerPay(player) + IsWorker = true + end + if RestaurantJob:IsWorker(player) then + Pay = RestaurantJob:GetPlayerPay(player) + IsWorker = true + end + if IceCreamJob:IsWorker(player) then + Pay = IceCreamJob:GetPlayerPay(player) + IsWorker = true + end + + if IsWorker then + JobRemotes.ShowStats:FireClient(player, Pay) + end + end +end) + " +4mzH8gLM,Untitled,pacho_the_python,Python,Saturday 9th of December 2023 02:36:38 PM CDT,"def heroes_dict(num): + hero_dict = {} + for i in range(num): + hero_data = input().split("" "") + hero_name = hero_data[0] + hp = int(hero_data[1]) + mp = int(hero_data[2]) + hero_dict[hero_name] = [hp, mp] + return hero_dict + + +def cast_spell(current_hero, needed_mp, spell, current_hero_dict): + if needed_mp <= current_hero_dict[current_hero][1]: + current_hero_dict[current_hero][1] -= needed_mp + return f""{current_hero} has successfully cast {spell} and now has {current_hero_dict[current_hero][1]} MP!"" + else: + return f""{current_hero} does not have enough MP to cast {spell}!"" + + +def take_damage(hero, damage, attacker, heroes): + if heroes[hero][0] > damage: + heroes[hero][0] -= damage + return f""{hero} was hit for {damage} HP by {attacker} and now has {heroes[hero][0]} HP left!"" + else: + del heroes[hero] + return f""{hero} has been killed by {attacker}!"" + + +def recharge(hero, recharge_mp, needed_mp, heroes): + if needed_mp >= recharge_mp: + heroes[hero][1] += recharge_mp + return f""{hero} recharged for {recharge_mp} MP!"" + else: + heroes[hero][1] += needed_mp + return f""{hero} recharged for {needed_mp} MP!"" + + +def heal(hero, healed_hp, needed_hp, heroes): + if needed_hp >= healed_hp: + heroes[hero][0] += healed_hp + return f""{hero} healed for {healed_hp} HP!"" + else: + heroes[hero][0] += needed_hp + return f""{hero} healed for {needed_hp} HP!"" + + +def get_info(heroes): + for k, v in heroes.items(): + print(f""{k}"") + print(f"" HP: {v[0]}"") + print(f"" MP: {v[1]}"") + + +def main_func(heroes): + command_data = input().split("" - "") + while True: + command = command_data[0] + if command == ""End"": + get_info(heroes) + break + + if command == ""CastSpell"": + hero = command_data[1] + mp_need = int(command_data[2]) + spell_name = command_data[3] + print(cast_spell(hero, mp_need, spell_name, heroes)) + + elif command == ""TakeDamage"": + hero = command_data[1] + damage = int(command_data[2]) + attacker = command_data[3] + print(take_damage(hero, damage, attacker, heroes)) + + elif command == ""Recharge"": + hero = command_data[1] + recharge_mp = int(command_data[2]) + needed_mp = 200 - heroes[hero][1] + print(recharge(hero, recharge_mp, needed_mp, heroes)) + + elif command == ""Heal"": + hero = command_data[1] + healed_hp = int(command_data[2]) + needed_hp = 100 - heroes[hero][0] + print(heal(hero, healed_hp, needed_hp, heroes)) + + command_data = input().split("" - "") + + +number = int(input()) + +main_func(heroes_dict(number)) +" +YdwD5JWF,Untitled,Dorex,Linden Scripting,Saturday 9th of December 2023 02:30:33 PM CDT,"default +{ + state_entry() + { + llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]); + } + + touch_start(integer total_number) + { + llSetKeyframedMotion([<0.0, 0.0, 5.0>, 5, <0.0, 0.0, -10.0>, 5], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD ]); + } + moving_end(){ + llOwnerSay(""moving_end""); + } + at_target(integer tnum, vector targetpos, vector ourpos) + { + llOwnerSay(""at_target""); + } +} +" +1FbBKgsX,Untitled,NOBODY6600,JSON,Saturday 9th of December 2023 02:11:28 PM CDT,"{""user_info"":{""username"":""francisco"",""password"":""francisco12345"",""message"":""Todos esportes OnDemand online (Star+, HBO Max, OneFootball, etc)!"",""auth"":1,""status"":""Active"",""exp_date"":""1735687010"",""is_trial"":""0"",""active_cons"":""0"",""created_at"":""1668455495"",""max_connections"":""1"",""allowed_output_formats"":[""m3u8"",""ts"",""rtmp""]},""server_info"":{""url"":""tv.painelsat.ovh"",""port"":""8080"",""https_port"":""8443"",""server_protocol"":""http"",""rtmp_port"":""25462"",""timezone"":""America\/Sao_Paulo"",""timestamp_now"":1702154105,""time_now"":""2023-12-09 17:35:05"",""process"":true}}" +BtB0f9PP,Untitled,kopyl,Python,Saturday 9th of December 2023 02:01:06 PM CDT,"WAIT_TIME = 1 +NAME = 'icons-train' + +IMAGE_NAME = f'runpod/pytorch:2.1.0-py3.10-cuda11.8.0-devel-ubuntu22.04' +GPU_TYPE_ID = 'NVIDIA A100 80GB PCIe' +OS_DISK_SIZE_GB = 100 +PERSISTENT_DISK_SIZE_GB = 0 +CLOUD_TYPE = 'SECURE' +MIN_DOWNLOAD_SPEED = 700 +DATA_CENTER_ID = 'EU-RO-1' +NETWORK_VOLUME_ID = '54epb6rtc4' +TEMPLATE_ID = 'ue50iblx66' +CUDA_VERSION = '12.2' +GPU_COUNT = 8 + +ERRORS = { + ""specs"": ( + ""There are no longer any instances available with "" + ""the requested specifications. Please refresh and try again."" + ), + ""disk"": ( + ""There are no longer any instances available with "" + ""enough disk space."" + ) +} + + +def create_pod(api, bar): + bar.update(1) + pod_config = f"""""" + cudaVersion: ""{CUDA_VERSION}"", + templateId: ""{TEMPLATE_ID}"", + networkVolumeId: ""{NETWORK_VOLUME_ID}"", + dataCenterId: ""{DATA_CENTER_ID}"", + minDownload: {MIN_DOWNLOAD_SPEED}, + gpuCount: {GPU_COUNT}, + volumeInGb: {PERSISTENT_DISK_SIZE_GB}, + containerDiskInGb: {OS_DISK_SIZE_GB}, + gpuTypeId: ""{GPU_TYPE_ID}"", + cloudType: {CLOUD_TYPE}, + supportPublicIp: true, + name: ""{NAME}"", + dockerArgs: """", + volumeMountPath: ""/workspace"", + imageName: ""{IMAGE_NAME}"", + startJupyter: true, + startSsh: true, + """""" + + response = api.create_on_demand_pod(pod_config) + resp_json = response.json() + + if response.status_code == 200: + if 'errors' in resp_json: + + for error in resp_json['errors']: + if error['message'] == ERRORS['specs']: + time.sleep(WAIT_TIME) + create_pod(api, bar) + elif error['message'] == ERRORS['disk']: + print(error) + print('No instances with enough disk space available, sleeping for 5 seconds') + time.sleep(WAIT_TIME) + create_pod(api, bar) + else: + print('ERROR: ' + error['message']) + else: + return + + +bar = tqdm() + +api = API(""XXX"") +res = create_pod(api, bar) +res" +iKNRx1LK,gitlab,dean360,JavaScript,Saturday 9th of December 2023 01:10:53 PM CDT,"stages: + - build + - test + - deploy + +build_job: + stage: build + script: + - echo ""Building the project..."" + # Add your build commands here + +test_job: + stage: test + script: + - echo ""Running tests..."" + # Add your test commands here + +deploy_job: + stage: deploy + script: + - echo ""Deploying the application..."" + # Add your deployment commands here +" +Am3QTEu7,Z2M Namron 4ch button,bjornidar,JSON,Saturday 9th of December 2023 01:09:59 PM CDT,"[ + { + ""id"": ""cded5b730fd1f90c"", + ""type"": ""zigbee2mqtt-in"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""9f11d4ee.0f2c98"", + ""friendly_name"": ""Lysbryter kontor"", + ""device_id"": ""0x04cd15fffe901ba0"", + ""state"": ""0"", + ""outputAtStartup"": true, + ""filterChanges"": true, + ""x"": 120, + ""y"": 60, + ""wires"": [ + [ + ""05aa7d2e2becf64f"", + ""d2a4ad904a3850f8"", + ""1cbf5a2da03d40a5"", + ""1a09845750ec10c1"", + ""0f576764ad9b0ec1"", + ""119a629f0ef481cf"", + ""b613a792c803e077"" + ] + ] + }, + { + ""id"": ""1a09845750ec10c1"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""func"": ""if(msg.payload.action == \""on_l1\"")\n return msg;"", + ""outputs"": 1, + ""timeout"": """", + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 460, + ""y"": 80, + ""wires"": [ + [ + ""8e55b08b8a391346"" + ] + ] + }, + { + ""id"": ""1cbf5a2da03d40a5"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""func"": ""if(msg.payload.action == \""off_l1\"")\n return msg;"", + ""outputs"": 1, + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 460, + ""y"": 140, + ""wires"": [ + [ + ""a5fe187fb83c20bc"" + ] + ] + }, + { + ""id"": ""d2a4ad904a3850f8"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": ""Dim up"", + ""func"": ""if(msg.payload.action == \""brightness_move_up_l1\"")\n{\n msg.payload = \""run\"";\n return msg;\n}\nif(msg.payload.action == \""brightness_stop_l1\"")\n{\n msg.payload = \""stop\"";\n return msg;\n}"", + ""outputs"": 1, + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 460, + ""y"": 200, + ""wires"": [ + [ + ""0d39b48f13f304b4"" + ] + ] + }, + { + ""id"": ""05aa7d2e2becf64f"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": ""Dim down"", + ""func"": ""if(msg.payload.action == \""brightness_move_down_l1\"")\n{\n msg.payload = \""run\"";\n return msg;\n}\nif(msg.payload.action == \""brightness_stop_l1\"")\n{\n msg.payload = \""stop\"";\n return msg;\n}"", + ""outputs"": 1, + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 460, + ""y"": 260, + ""wires"": [ + [ + ""4eccf48dac7d32e6"" + ] + ] + }, + { + ""id"": ""8e55b08b8a391346"", + ""type"": ""api-call-service"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""c8cb3214edd39cea"", + ""version"": 5, + ""debugenabled"": false, + ""domain"": ""light"", + ""service"": ""turn_on"", + ""areaId"": [], + ""deviceId"": [], + ""entityId"": [ + ""light.lys_kontor"" + ], + ""data"": """", + ""dataType"": ""json"", + ""mergeContext"": """", + ""mustacheAltTags"": false, + ""outputProperties"": [], + ""queue"": ""none"", + ""output_location"": ""payload"", + ""output_location_type"": ""none"", + ""x"": 870, + ""y"": 80, + ""wires"": [ + [] + ] + }, + { + ""id"": ""a5fe187fb83c20bc"", + ""type"": ""api-call-service"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""c8cb3214edd39cea"", + ""version"": 5, + ""debugenabled"": false, + ""domain"": ""light"", + ""service"": ""turn_off"", + ""areaId"": [], + ""deviceId"": [], + ""entityId"": [ + ""light.lys_kontor"" + ], + ""data"": """", + ""dataType"": ""json"", + ""mergeContext"": """", + ""mustacheAltTags"": false, + ""outputProperties"": [], + ""queue"": ""none"", + ""output_location"": ""payload"", + ""output_location_type"": ""none"", + ""x"": 870, + ""y"": 140, + ""wires"": [ + [] + ] + }, + { + ""id"": ""5483451ff86ed391"", + ""type"": ""api-call-service"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""c8cb3214edd39cea"", + ""version"": 5, + ""debugenabled"": false, + ""domain"": ""light"", + ""service"": ""turn_on"", + ""areaId"": [], + ""deviceId"": [], + ""entityId"": [ + ""light.lys_kontor"" + ], + ""data"": """", + ""dataType"": ""json"", + ""mergeContext"": """", + ""mustacheAltTags"": false, + ""outputProperties"": [], + ""queue"": ""none"", + ""output_location"": ""payload"", + ""output_location_type"": ""none"", + ""x"": 1230, + ""y"": 200, + ""wires"": [ + [] + ] + }, + { + ""id"": ""e90baa8273f9b0a3"", + ""type"": ""api-call-service"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""c8cb3214edd39cea"", + ""version"": 5, + ""debugenabled"": false, + ""domain"": ""light"", + ""service"": ""turn_on"", + ""areaId"": [], + ""deviceId"": [], + ""entityId"": [ + ""light.lys_kontor"" + ], + ""data"": """", + ""dataType"": ""json"", + ""mergeContext"": """", + ""mustacheAltTags"": false, + ""outputProperties"": [], + ""queue"": ""none"", + ""output_location"": ""payload"", + ""output_location_type"": ""none"", + ""x"": 1230, + ""y"": 260, + ""wires"": [ + [] + ] + }, + { + ""id"": ""552b557e9f046c8f"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""func"": ""var _brightness = msg.data.attributes.brightness + 20;\n\n\nvar newMsg = {\n payload: { \""data\"":{\""brightness\"":_brightness}}\n};\nreturn newMsg;\n\n"", + ""outputs"": 1, + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 1060, + ""y"": 200, + ""wires"": [ + [ + ""5483451ff86ed391"" + ] + ] + }, + { + ""id"": ""2134e07ff17860ef"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""func"": ""var _brightness = msg.data.attributes.brightness - 20;\n\n\nvar newMsg = {\n payload: { \""data\"":{\""brightness\"":_brightness}}\n};\nreturn newMsg;\n\n"", + ""outputs"": 1, + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 1060, + ""y"": 260, + ""wires"": [ + [ + ""e90baa8273f9b0a3"" + ] + ] + }, + { + ""id"": ""4118bc1bcaaf3f0d"", + ""type"": ""api-current-state"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": ""Dimmer1 Kjøkken"", + ""server"": ""c8cb3214edd39cea"", + ""version"": 3, + ""outputs"": 1, + ""halt_if"": """", + ""halt_if_type"": ""str"", + ""halt_if_compare"": ""is"", + ""entity_id"": ""light.lys_kontor"", + ""state_type"": ""str"", + ""blockInputOverrides"": false, + ""outputProperties"": [ + { + ""property"": ""payload"", + ""propertyType"": ""msg"", + ""value"": """", + ""valueType"": ""entityState"" + }, + { + ""property"": ""data"", + ""propertyType"": ""msg"", + ""value"": """", + ""valueType"": ""entity"" + } + ], + ""for"": 0, + ""forType"": ""num"", + ""forUnits"": ""minutes"", + ""x"": 870, + ""y"": 200, + ""wires"": [ + [ + ""552b557e9f046c8f"" + ] + ] + }, + { + ""id"": ""0d39b48f13f304b4"", + ""type"": ""looptimer"", + ""z"": ""70dc1c1b7f7c9b00"", + ""duration"": ""1"", + ""units"": ""Second"", + ""maxloops"": ""15"", + ""maxtimeout"": ""1"", + ""maxtimeoutunits"": ""Minute"", + ""name"": """", + ""x"": 620, + ""y"": 200, + ""wires"": [ + [ + ""4118bc1bcaaf3f0d"" + ], + [] + ] + }, + { + ""id"": ""4eccf48dac7d32e6"", + ""type"": ""looptimer"", + ""z"": ""70dc1c1b7f7c9b00"", + ""duration"": ""1"", + ""units"": ""Second"", + ""maxloops"": ""15"", + ""maxtimeout"": ""1"", + ""maxtimeoutunits"": ""Minute"", + ""name"": """", + ""x"": 620, + ""y"": 260, + ""wires"": [ + [ + ""1d0b6923fa3bbb5c"" + ], + [] + ] + }, + { + ""id"": ""1d0b6923fa3bbb5c"", + ""type"": ""api-current-state"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": ""Dimmer1 Kjøkken"", + ""server"": ""c8cb3214edd39cea"", + ""version"": 3, + ""outputs"": 1, + ""halt_if"": """", + ""halt_if_type"": ""str"", + ""halt_if_compare"": ""is"", + ""entity_id"": ""light.lys_kontor"", + ""state_type"": ""str"", + ""blockInputOverrides"": false, + ""outputProperties"": [ + { + ""property"": ""payload"", + ""propertyType"": ""msg"", + ""value"": """", + ""valueType"": ""entityState"" + }, + { + ""property"": ""data"", + ""propertyType"": ""msg"", + ""value"": """", + ""valueType"": ""entity"" + } + ], + ""for"": 0, + ""forType"": ""num"", + ""forUnits"": ""minutes"", + ""x"": 870, + ""y"": 260, + ""wires"": [ + [ + ""2134e07ff17860ef"" + ] + ] + }, + { + ""id"": ""119a629f0ef481cf"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""func"": ""if(msg.payload.action == \""on_l2\"")\n return msg;"", + ""outputs"": 1, + ""timeout"": """", + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 460, + ""y"": 360, + ""wires"": [ + [ + ""488aae873321c7dc"" + ] + ] + }, + { + ""id"": ""b613a792c803e077"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""func"": ""if(msg.payload.action == \""off_l2\"")\n return msg;"", + ""outputs"": 1, + ""timeout"": """", + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 460, + ""y"": 420, + ""wires"": [ + [ + ""6a8c660e839a57bf"" + ] + ] + }, + { + ""id"": ""488aae873321c7dc"", + ""type"": ""api-call-service"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""c8cb3214edd39cea"", + ""version"": 5, + ""debugenabled"": false, + ""domain"": ""light"", + ""service"": ""turn_on"", + ""areaId"": [], + ""deviceId"": [], + ""entityId"": [ + ""light.wled"" + ], + ""data"": """", + ""dataType"": ""json"", + ""mergeContext"": """", + ""mustacheAltTags"": false, + ""outputProperties"": [], + ""queue"": ""none"", + ""output_location"": ""payload"", + ""output_location_type"": ""none"", + ""x"": 870, + ""y"": 360, + ""wires"": [ + [] + ] + }, + { + ""id"": ""6a8c660e839a57bf"", + ""type"": ""api-call-service"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""c8cb3214edd39cea"", + ""version"": 5, + ""debugenabled"": false, + ""domain"": ""light"", + ""service"": ""turn_off"", + ""areaId"": [], + ""deviceId"": [], + ""entityId"": [ + ""light.wled"" + ], + ""data"": """", + ""dataType"": ""json"", + ""mergeContext"": """", + ""mustacheAltTags"": false, + ""outputProperties"": [], + ""queue"": ""none"", + ""output_location"": ""payload"", + ""output_location_type"": ""none"", + ""x"": 870, + ""y"": 420, + ""wires"": [ + [] + ] + }, + { + ""id"": ""88ffce3ca379aacb"", + ""type"": ""api-call-service"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""c8cb3214edd39cea"", + ""version"": 5, + ""debugenabled"": false, + ""domain"": ""light"", + ""service"": ""turn_off"", + ""areaId"": [], + ""deviceId"": [], + ""entityId"": [ + ""light.wled"" + ], + ""data"": """", + ""dataType"": ""json"", + ""mergeContext"": """", + ""mustacheAltTags"": false, + ""outputProperties"": [], + ""queue"": ""none"", + ""output_location"": ""payload"", + ""output_location_type"": ""none"", + ""x"": 190, + ""y"": 240, + ""wires"": [ + [] + ] + }, + { + ""id"": ""496c305d23615fcc"", + ""type"": ""api-call-service"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""server"": ""c8cb3214edd39cea"", + ""version"": 5, + ""debugenabled"": false, + ""domain"": ""light"", + ""service"": ""turn_off"", + ""areaId"": [], + ""deviceId"": [], + ""entityId"": [ + ""light.lys_kontor"" + ], + ""data"": """", + ""dataType"": ""json"", + ""mergeContext"": """", + ""mustacheAltTags"": false, + ""outputProperties"": [], + ""queue"": ""none"", + ""output_location"": ""payload"", + ""output_location_type"": ""none"", + ""x"": 190, + ""y"": 280, + ""wires"": [ + [] + ] + }, + { + ""id"": ""0f576764ad9b0ec1"", + ""type"": ""function"", + ""z"": ""70dc1c1b7f7c9b00"", + ""name"": """", + ""func"": ""if(msg.payload.action == \""off_l4\"")\n return msg;"", + ""outputs"": 1, + ""timeout"": """", + ""noerr"": 0, + ""initialize"": """", + ""finalize"": """", + ""libs"": [], + ""x"": 160, + ""y"": 180, + ""wires"": [ + [ + ""88ffce3ca379aacb"", + ""496c305d23615fcc"" + ] + ] + }, + { + ""id"": ""9f11d4ee.0f2c98"", + ""type"": ""zigbee2mqtt-server"", + ""name"": ""Z2M"", + ""host"": """", + ""mqtt_port"": ""1883"", + ""mqtt_username"": """", + ""mqtt_password"": """", + ""tls"": """", + ""usetls"": false, + ""base_topic"": ""zigbee2mqtt"" + }, + { + ""id"": ""c8cb3214edd39cea"", + ""type"": ""server"", + ""name"": ""Home Assistant"", + ""version"": 5, + ""addon"": true, + ""rejectUnauthorizedCerts"": true, + ""ha_boolean"": ""y|yes|true|on|home|open"", + ""connectionDelay"": true, + ""cacheJson"": true, + ""heartbeat"": false, + ""heartbeatInterval"": ""30"", + ""areaSelector"": ""friendlyName"", + ""deviceSelector"": ""friendlyName"", + ""entitySelector"": ""friendlyName"", + ""statusSeparator"": "": "", + ""statusYear"": ""hidden"", + ""statusMonth"": ""short"", + ""statusDay"": ""numeric"", + ""statusHourCycle"": ""default"", + ""statusTimeFormat"": ""h:m"", + ""enableGlobalContextStore"": false + } +]" +UiFGgis4,ansi2html example 20231209,jlpoole,HTML,Saturday 9th of December 2023 01:08:11 PM CDT,"jlpoole@ares /var/www/localhost/htdocs/demo $ cat -n 2021_08_21_retina_log.html + 1 + 2 + 3 + 4 + 5 + 6 + 18 + 19 + 20 <pre class=""ansi2html-content""> + 21 Script started on 2021-08-21 19:47:24-07:00 [TERM=""xterm-256color"" TTY=""/dev/pts/9"" COLUMNS=""149"" LINES=""54""] + 22 ... + 52 Script done on 2021-08-21 19:47:44-07:00 [COMMAND_EXIT_CODE=""0""] + 53 + 54 </pre> + 55 + 56 + 57 `" +LCWs7nCm,MP06_UF4_EJ3,Mike7GB,Java,Saturday 9th of December 2023 01:03:05 PM CDT,"************** +---- MAIN ---- +************** + +package mp06_uf4_ej3; + +import MisBeans.GeneraAnalisis; // receptor o listener (ESCUCHA LOS EVENTOS) +import MisBeans.Paciente; // fuente o source o emisor (GENERA EL EVENTO) + +/** + * + * @author luism + */ +public class MP06_UF4_EJ3 { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + Paciente paciente1 = new Paciente(""Alan"", ""Brito"", 35, 6555555, 10, 44444); + GeneraAnalisis analisis1 = new GeneraAnalisis(); + + analisis1.setPaciente(paciente1); + paciente1.addPropertyChangeListener(analisis1); + + paciente1.setUltimoHierro(14); + + } + +} + + +****************** +---- PACIENTE ---- +****************** + +package MisBeans; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; + +/** + * + * @author luism + */ +public class Paciente implements Serializable { // EJB Fuente -> Quien genera el evento (la alerta) + // Si un paciente tiene un análisis con resultado ultimoHierro > 10 deberá hacerse un nuevo análisis + private String nombre; + private String apellido; + private int edad; + private int telefono; + private int ultimoHierro; + private int ultimoUrea; + private PropertyChangeSupport propertySupport; // puede generar un evento + + /* + Constructor sin argumentos + */ + public Paciente(){ + propertySupport = new PropertyChangeSupport(this); + } + + /* + Constructor con 3 argumentos + nombre, apellido, edad + */ + public Paciente(String nombre, String apellido, int edad){ + this.nombre = nombre; + this.apellido = apellido; + this.edad = edad; + propertySupport = new PropertyChangeSupport(this); + } + + /* + Constructor con 6 argumentos + nombre, apellido, edad, teléfono, último hierro, último urea + */ + public Paciente(String nombre, String apellido, int edad, int telefono, int ultimo_hierro, int ultimo_urea){ + this.nombre = nombre; + this.apellido = apellido; + this.edad = edad; + this.telefono = telefono; + this.ultimoHierro = ultimo_hierro; + this.ultimoUrea = ultimo_urea; + propertySupport = new PropertyChangeSupport(this); + } + + /* + GETTERS y SETTERS + */ + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public String getApellido() { + return apellido; + } + + public void setApellido(String apellido) { + this.apellido = apellido; + } + + public int getEdad() { + return edad; + } + + public void setEdad(int edad) { + this.edad = edad; + } + + public int getTelefono() { + return telefono; + } + + public void setTelefono(int telefono) { + this.telefono = telefono; + } + + public int getUltimoHierro() { + return ultimoHierro; + } + + public void setUltimoHierro(int ultimoHierro) { + int valorAnterior = this.ultimoHierro; + this.ultimoHierro = ultimoHierro; + if (this.ultimoHierro > 10) { // Si se cumple la condición hay que lanzar evento + propertySupport.firePropertyChange(""ultimoHierro"", valorAnterior, this.ultimoHierro); // AQUI SE LANZA EL EVENTO + } + } + + public int getUltimoUrea() { + return ultimoUrea; + } + + public void setUltimoUrea(int ultimoUrea) { + this.ultimoUrea = ultimoUrea; + } + + public PropertyChangeSupport getPropertySupport() { + return propertySupport; + } + + public void setPropertySupport(PropertyChangeSupport propertySupport) { + this.propertySupport = propertySupport; + } + + public void addPropertyChangeListener(PropertyChangeListener listener){ + propertySupport.addPropertyChangeListener(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener){ + propertySupport.removePropertyChangeListener(listener); + } + +} + + + +******************* +---- G.ANLASIS ---- +******************* + +package MisBeans; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.Serializable; +import java.util.Date; + +/** + * + * @author luism + */ +public class GeneraAnalisis implements Serializable, PropertyChangeListener { // EJB Listener -> Quien escucha el evento + + private int numAnalisis; + private Paciente paciente; + private Date fecha; + private int analisisPendiente; + + public GeneraAnalisis(){ + } + + public GeneraAnalisis(int numAnalisis, Paciente paciente, Date fecha, int analisisPendiente){ + this.numAnalisis = numAnalisis; + this.paciente = paciente; + this.fecha = fecha; + this.analisisPendiente = analisisPendiente; + } + + public int getNumAnalisis() { + return numAnalisis; + } + + public void setNumAnalisis(int numAnalisis) { + this.numAnalisis = numAnalisis; + } + + public Paciente getPaciente() { + return paciente; + } + + public void setPaciente(Paciente paciente) { + this.paciente = paciente; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public int getAnalisisPendiente() { + return analisisPendiente; + } + + public void setAnalisisPendiente(int analisisPendiente) { + this.analisisPendiente = analisisPendiente; + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + System.out.printf(""Hierro anterior: %d%n"", evt.getOldValue()); + System.out.printf(""Hierro actual: %d%n"", evt.getNewValue()); + System.out.printf(""REALIZAR NUEVO ANÁLISIS AL PACIENTE: %s%n"", paciente.getNombre()+"" ""+paciente.getApellido()); + + //throw new UnsupportedOperationException(""Not supported yet.""); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + +}" +EDk2636z,script.js,Piotr_Karol,JavaScript,Saturday 9th of December 2023 12:52:39 PM CDT,"window.onload = ()=> { + disapear(); + fillMenuBlack(); + fillMenuWhite(); + menuButtons(); +} + +function disapear() { + var section = document.querySelector(""#disappearingLogo""); + section.innerHTML = ''; + section.scrollIntoView({behavior: 'smooth'}); + var main = document.querySelector("".page""); + var logo = document.querySelector(""#disappearingLogoIMG"") + logo.addEventListener(""animationend"", () => { + main.scrollIntoView({behavior: 'smooth'}); + }); +} + +function fillMenuBlack() { + let menuBlack = document.querySelectorAll("".menuBlack""); + let menuBlackBody = '\n'; + + menuBlackBody += '
' + menuBlackBody += '\n'; + menuBlackBody += '
\n'; + menuBlackBody += '\n'; + menuBlackBody += '\n'; + menuBlackBody += '
\n'; + + menuBlackBody += '\n'; + menuBlackBody += '\n'; + for (let i in menuBlack) { + menuBlack[i].innerHTML = menuBlackBody; + } +} + +function fillMenuWhite() { + const menuWhite = document.querySelectorAll("".menuWhite""); + let menuWhiteBody = '\n'; + menuWhiteBody += '\n'; + menuWhiteBody += '\n'; + menuWhiteBody += '\n'; + for (var i in menuWhite) { + menuWhite[i].innerHTML = menuWhiteBody; + } +} + +function menuButtons() { + const main = document.querySelector("".screen""); + const buttons = document.querySelectorAll("".home""); + buttons.forEach(function(button){ + button.addEventListener(""click"", () => { + main.scrollIntoView({behavior: 'smooth'}); + }); + }); +} + +" +CZhCS5vg,style.css,Piotr_Karol,CSS,Saturday 9th of December 2023 12:52:02 PM CDT,"html { + font-family:'Roboto'; +} + +body { + overflow: hidden; +} + +#disappearingLogoIMG { + opacity: 0; + animation: fade-in 2s ease-in forwards, fade-out 2s 2s ease-out forwards; +} + +@keyframes fade-in { + 100% { + opacity: 1; + } + } + +@keyframes fade-out { + 0% { + opacity: 1; + } + 100% { + transform: translateY(-150%); + } +} + +.page { + scroll-snap-type: y mandatory; + overflow-y: scroll; + overflow-x: hidden; + height: 100vh; +} + +.screen { + scroll-snap-align: start; + width: 100%; +} + +.content { + padding: 100px 100px 100px 100px; +} + +#disappearingLogo { + height: 100vh; + width:100vw; + display: flex; + justify-content: center; + align-items: center; + background-color: black; + img { + height: 70vh; + } +} + +.menuBlack { + height: 105px; + width:100vw; + background-color: black; + display: flex; + justify-content: center; + align-items: center; + #MBhome { + position: relative; + #MBimgmain { + position: relative; + opacity: 1; + width: 90px; + } + #MBimghover { + position: absolute; + opacity: 0; + width: 0px; + } + } + #MBhome:hover { + position: relative; + #MBimgmain { + position: absolute; + opacity: 0; + width: 0px; + } + #MBimghover { + position: relative; + opacity: 1; + width: 90px; + } + } + + .dropdownBlackContent { + display: none; + position: absolute; + z-index: 1; + } + + .dopdownBlack:hover { + button { + display: block; + margin-top: 0px; + margin-bottom: 0px; + background-color: white; + color: black; + } + + .dropdownBlackContent { + display: block; + button:hover { + background-color: lightgray; + } + } + } + + button { + height: 65px; + width: 120px; + padding: 5px 15px; + margin: 20px; + background-color: black; + color: white; + border: none; + } + button:hover { + background-color:white; + color: black; + } +} + +.menuWhite { + height: 105px; + width:100vw; + background-color: white; + display: flex; + justify-content: center; + align-items: center; + + #MWhome { + position: relative; + #MWimgmain { + position: relative; + opacity: 1; + width: 90px; + } + #MWimghover { + position: absolute; + opacity: 0; + width: 0px; + } + } + #MWhome:hover { + position: relative; + #MWimgmain { + position: absolute; + opacity: 0; + width: 0px; + } + #MWimghover { + position: relative; + opacity: 1; + width: 90px; + } + } + + button { + height: 65px; + width: 120px; + padding: 5px 15px; + border-radius: 25px; + margin-left: 20px; + margin-right: 20px; + background-color: white; + color: black; + border: none; + } + button:hover { + background-color:black; + color: white; + } +} + +#eclipse { + height: 100vh; + width:100vw; + background-image: url(images/eclipse/eclipse.jpg); + background-size: 100%; + #eclipseGameLogo { + width: 10%; + } + #eclipseLearnMore { + background-color: white; + color: black; + font-size: large; + padding: 25px 25px; + margin-top: 4px; + border-radius: 55px; + border: none; + } +} + +#dreadborne { + height: 100vh; + width:100vw; + background-image: url(images/dreadborne/dreadborne.jpg); + background-size: 100%; + #dreadborneGameLogo { + width: 10%; + } + #dreadborneLearnMore { + background-color: white; + color: black; + font-size: large; + padding: 25px 25px; + margin-top: 4px; + border-radius: 55px; + border: none; + } +} + +#team { + height: 100vh; + width:100vw; + background-color: white; + color: black; +} + +#media { + height: 100vh; + width:100vw; + background-color: black; + color: white; +} + +" +hfaBZMun,index.html,Piotr_Karol,HTML 5,Saturday 9th of December 2023 12:51:00 PM CDT," + + + + + + + + RAPID Studio + + +
+ +
+ +
+
+
+

Osadzona w świecie 30 lat po wojnie nuklearnej gra z elementami multiplayer,
+ gdzie musisz uważać zarówno na mordercze promieniowanie ale również na innych ludzi.

+ + +
+
+
+
+
+ + +

Wielokrotnie nagradzana gra RPG z otwartym światem w klimatach dark fantasy,
+ w której każdy wybór niesie za sobą konsekwencje.

+
+ +
+
+
+
+

Poznaj nas

+

2 przyciski i chuj

+
+
+ +
+
+
+

Znajdź nas na

+

tutaj podane będą media w liście

+

Lokalizacje

+

a tutaj pobrane z bazy danych lokalizacje

+
+
+
+ + +" +eW5bVSA9,AOC 2023 Day 9,nairby,Rust,Saturday 9th of December 2023 12:44:40 PM CDT,"use std::env; +use std::io::{self, prelude::*, BufReader}; +use std::fs::File; + +#[derive(Debug)] +struct History { + values: Vec, +} +impl From<&String> for History { + fn from(s: &String) -> Self { + Self { + values: s.split_whitespace().map(|n| n.parse::().unwrap()).collect(), + } + } +} +impl History { + pub fn solve(&self) -> (isize,isize) { + // Initializations + let mut values: Vec = self.values.clone(); + let mut first_values: Vec = vec![*values.first().unwrap()]; + let mut last_values: Vec = vec![*values.last().unwrap()]; + // Do diffs + loop { + let diffs: Vec<_> = values.windows(2).map(|v| v[1] - v[0]).collect(); + values = diffs.clone(); + first_values.push(*diffs.first().unwrap()); + last_values.push( *diffs.last().unwrap()); + if diffs.iter().all(|v| *v == 0isize) { break; } + } + // Identify first value + let first = first_values.iter().rev().fold(0, |acc,x| x - acc); + (last_values.iter().sum(),first) + } +} + +fn solve(input: &str) -> io::Result<()> { + let file = File::open(input).expect(""Input file not found.""); + let reader = BufReader::new(file); + + // Input + let input: Vec = match reader.lines().collect() { + Err(err) => panic!(""Unknown error reading input: {err}""), + Ok(result) => result, + }; + let input: Vec<_> = input.iter().map(History::from).collect(); + + let part1: isize = input.iter().map(|x| x.solve().0).sum(); + println!(""Part 1: {part1}""); // 1684566095 + + let part2: isize = input.iter().map(|x| x.solve().1).sum(); + println!(""Part 2: {part2}""); // 1136 + + Ok(()) +} + + +fn main() { + let args: Vec = env::args().collect(); + let filename = &args[1]; + solve(&filename).unwrap(); +} +" +tAT2JA50,AOC23D9P2.py,avltree9798,Python,Saturday 9th of December 2023 12:37:22 PM CDT,"import sys + + +def parse_input(input_file): + with open(input_file, 'r') as f: + contents = f.read().split('\n') + return [y for y in [x.split(' ') for x in contents]] + +def predict_past_value(data: [int], board = None) -> int: + if sum(data) == 0: + for i in range(len(board)-2, 0, -1): + board[i-1].append(board[i-1][-1] - board[i][-1]) + return board[0][-1] + if board is None: + board = {0: data[::-1]} + current_index = len(board) + board.setdefault(current_index, []) + for i in range(len(data)-2, -1, -1): + board[current_index].append(data[i+1]-data[i]) + return predict_past_value(board[current_index][::-1], board) + +def main(input_file): + historical_data = parse_input(input_file) + result = 0 + for data in historical_data: + current_data = [int(x) for x in data] + result += predict_past_value(current_data) + print(result) + +if __name__ == '__main__': + input_file = 'input.txt' + if len(sys.argv) == 2: + input_file = sys.argv[1] + main(input_file) +" +86SQHxe4,Untitled,Mysoft,C,Saturday 9th of December 2023 12:34:38 PM CDT,"#include +#include + +#include +#include + +DWORD get_parent_process_id(void) +{ + HANDLE hSnap; + PROCESSENTRY32 pent; + DWORD pid; + + pid = GetCurrentProcessId(); + printf(""pid: %u\n"", pid); + hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, pid); + if (hSnap == INVALID_HANDLE_VALUE) + return 0; + pent.dwSize = sizeof(pent); + if (Process32First(hSnap, &pent)) + { + do { + if (pent.th32ProcessID == pid) { + printf(""pid: %u, parent: %u, exe: %s\n"", + pent.th32ProcessID, pent.th32ParentProcessID, pent.szExeFile); + return pent.th32ParentProcessID; + } + } while (Process32Next(hSnap, &pent)); + } + puts(""failed""); + return 0; +} + +int main(void) +{ + DWORD ppid = get_parent_process_id(); + printf(""parent = %u\n"", ppid); + return 0; +}" +SAxzk1mn,Untitled,dekxrma,Python,Saturday 9th of December 2023 11:52:51 AM CDT,"import concurrent.futures, time +from selenium import webdriver +from selenium.webdriver.chrome.service import Service + +def work(): + driver_options = webdriver.ChromeOptions() + + driver_options.add_argument('--headless=new') + driver_options.add_argument('--disable-gpu') + driver_options.add_argument('--no-sandbox') + + chromedriver_path = ""chromedriver"" + + service = Service(chromedriver_path) + + driver = webdriver.Chrome(service=service, options=driver_options) + + driver.get('https://google.com') + print(driver.title) + + time.sleep(10) + +threads = [] + +with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: + for _ in range(20): + threads.append(executor.submit(work)) + time.sleep(1) + + for thread in threads: + try: + print(thread.result()) + except Exception as exception: + print(exception)" +1aQbeE35,simple snippet,Arexils,Python,Saturday 9th of December 2023 11:46:16 AM CDT," +class BackButton(miru.Button): + def __init__(self, *args, **kwargs) -> None: + super().__init__( + label=kwargs.pop('label', 'Back'), + style=hikari.ButtonStyle.PRIMARY, + *args, + **kwargs, + ) + + async def callback(self, ctx: miru.ViewContext, **kwargs) -> None: + # How do I make it go back to the beginning? + ... + + +class BuildOptionButton(miru.Button): + def __init__(self, *args, **kwargs) -> None: + super().__init__( + *args, + **kwargs, + style=hikari.ButtonStyle.PRIMARY, + ) + + async def callback(self, ctx: miru.ViewContext, **kwargs) -> None: + # self.view.clear_items() + self.view.add_item( + miru.TextSelect( + placeholder=f'option', + options=[ + miru.SelectOption(label=""Option 1""), + miru.SelectOption(label=""Option 2""), + ], + ) + ) + self.view.add_item(BackButton()) + await ctx.message.edit('next menu', components=self.view) + + +class AccountBaseMenu(miru.View): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.add_item(BuildOptionButton(label='add some')) + self.add_item(BuildOptionButton(label='add other')) + + @miru.button(label='Apply', style=hikari.ButtonStyle.SUCCESS, row=2) + async def accept_button(self, button: miru.Button, ctx: miru.ViewContext) -> None: ... + + @miru.button(label='Cancel', style=hikari.ButtonStyle.DANGER, row=2) + async def cancel_button(self, button: miru.Button, ctx: miru.ViewContext) -> None: ... + + + +@test_plugin.command +@lightbulb.command( + 'test_1', + 'nothing', + pass_options=True, + auto_defer=True, +) +@lightbulb.implements(lightbulb.SlashCommand) +async def command_test_1( + ctx: lightbulb.Context, +): + view_first = AccountBaseMenu(timeout=300) + message = await ctx.respond( + Embed( + title=f'some name', + description='some text', + ), + components=view_first, + ) + await view_first.start(message) + await view_first.wait() + +" +X4NRdDPg,Test Railway Station,bAngelov,Python,Saturday 9th of December 2023 11:24:09 AM CDT,"from collections import deque +from unittest import TestCase, main + +from project.railway_station import RailwayStation + + +class TestRailwayStation(TestCase): + + def setUp(self): + self.station = RailwayStation(""MyRailway"") + + def test_initialization(self): + self.assertEqual(self.station.name, ""MyRailway"") + self.assertEqual(self.station._RailwayStation__name, ""MyRailway"") + self.assertEqual(type(self.station.arrival_trains), deque) + self.assertEqual(type(self.station.departure_trains), deque) + + def test_name(self): + self.assertEqual(self.station.name,""MyRailway"") + with self.assertRaises(ValueError) as ve: + self.station.name = ""rai"" + self.assertEqual(str(ve.exception), ""Name should be more than 3 symbols!"") + self.assertEqual(self.station.name, ""MyRailway"") + with self.assertRaises(ValueError) as ve: + self.station.name = ""ra"" + self.assertEqual(str(ve.exception), ""Name should be more than 3 symbols!"") + self.assertEqual(self.station.name, ""MyRailway"") + + def test_new_arrival_on_board(self): + self.assertEqual(self.station.arrival_trains, deque()) + self.station.new_arrival_on_board(""Anyone"") + self.assertEqual(self.station.arrival_trains[-1],""Anyone"") + + def test_train_has_arrived(self): + self.station.new_arrival_on_board(""Anyone"") + self.station.new_arrival_on_board(""Someone"") + self.assertEqual(self.station.train_has_arrived(""Someone""), ""There are other trains to arrive before Someone."") + self.assertEqual(self.station.arrival_trains, deque([""Anyone"",""Someone""])) + self.assertEqual(self.station.train_has_arrived(""Anyone""), ""Anyone is on the platform and will leave in 5 minutes."") + self.assertEqual(self.station.arrival_trains, deque([""Someone""])) + self.assertEqual(self.station.departure_trains, deque([""Anyone""])) + self.assertEqual(self.station.arrival_trains, deque([""Someone""])) + + def test_train_has_left(self): + self.station.new_arrival_on_board(""Anyone"") + self.station.train_has_arrived(""Anyone"") + self.assertEqual(self.station.train_has_left(""Anyone""), True) + self.assertEqual(self.station.train_has_left(""Someone""), False) + self.station.new_arrival_on_board(""Anyone"") + self.station.train_has_arrived(""Anyone"") + self.station.new_arrival_on_board(""Someone"") + self.station.train_has_arrived(""Someone"") + self.assertEqual(self.station.train_has_left(""Someone""), False) + +if __name__ == '__main__': + main() +" +VBtabc4E,03.Phonebook,Yonkow,JavaScript,Saturday 9th of December 2023 11:20:35 AM CDT,"function attachEvents() { + const baseURL = 'http://localhost:3030/jsonstore/phonebook'; + + const loadBtn = document.getElementById('btnLoad'); + const createBtn = document.getElementById('btnCreate'); + const person = document.getElementById('person'); + const phone = document.getElementById('phone'); + const phonebook = document.getElementById('phonebook'); + + let allPhones = {}; + loadBtn.addEventListener('click', loadPhoneBook); + createBtn.addEventListener('click', createNewPhone); + + async function loadPhoneBook () { + phonebook.innerHTML = ''; + + const response = await fetch(baseURL); + allPhones = await response.json(); + + for (const [key, elements] of Object.entries(allPhones)) { + const deleteBtn = document.createElement('button'); + deleteBtn.innerText = 'Delete'; + + const li = document.createElement('li'); + li.id = key; + li.textContent = `${elements.person}: ${elements.phone}` + li.appendChild(deleteBtn); + phonebook.appendChild(li); + + deleteBtn.addEventListener('click', deletePhone); + + async function deletePhone () { + + await fetch(`http://localhost:3030/jsonstore/phonebook/${key} `, { + method: 'DELETE', + }); + li.remove(); + + }; + } + + } + + async function createNewPhone () { + await fetch(baseURL, { + method: 'POST', + body: JSON.stringify({ + person: person.value, + phone: phone.value + }) + }) + loadPhoneBook(); + person.value = """"; + phone.value = """"; + }; + + // async function deletePhone(event) { + + // let currentPhone = event.target.parentNode; + // let currentkey = currentPhone.id; + // await fetch(`${baseURL}/${currentkey}`, { + // method: 'DELETE' + // }); + // currentPhone.remove(); + // } +} + +attachEvents();" +m4VvDkhd,Guess Game,quhluh,Python,Saturday 9th of December 2023 10:56:28 AM CDT,"import random + +def guess_the_number(): + print(""Welcome to Guess the Number!"") + print(""I'm thinking of a number between 1 and 100."") + + # Generate a random number between 1 and 100 + secret_number = random.randint(1, 100) + + attempts = 0 + + while True: + try: + # Get the player's guess + guess = int(input(""Enter your guess: "")) + attempts += 1 + + # Check if the guess is correct + if guess == secret_number: + print(f""Congratulations! You guessed the number in {attempts} attempts."") + break + elif guess < secret_number: + print(""Too low! Try again."") + else: + print(""Too high! Try again."") + + except ValueError: + print(""Invalid input. Please enter a valid number."") + +if __name__ == ""__main__"": + guess_the_number() +Copy and paste this code into a Python file (e.g., guess_the_number.py) and run it. This simple game asks the player to guess a randomly generated number between 1 and 100. The game provides feedback on whether the guess is too high, too low, or correct. The game continues until the player correctly guesses the number." +4it6CRxT,kdenlive-23.08.3.ebuild,jlpoole,Bash,Saturday 9th of December 2023 10:32:56 AM CDT,"lpoole@eos ~/work/kdenlive $ cat -n /var/db/repos/gentoo/kde-apps/kdenlive/kdenlive-23.08.3.ebuild + 1 # Copyright 1999-2023 Gentoo Authors + 2 # Distributed under the terms of the GNU General Public License v2 + 3 + 4 EAPI=8 + 5 + 6 ECM_DESIGNERPLUGIN=""true"" + 7 ECM_HANDBOOK=""optional"" + 8 ECM_QTHELP=""true"" + 9 ECM_TEST=""true"" + 10 KFMIN=5.106.0 + 11 QTMIN=5.15.9 + 12 inherit ecm gear.kde.org optfeature + 13 + 14 DESCRIPTION=""Non-linear video editing suite by KDE"" + 15 HOMEPAGE=""https://kdenlive.org/en/"" + 16 + 17 LICENSE=""GPL-3"" + 18 SLOT=""5"" + 19 KEYWORDS=""amd64 arm64 ~ppc64 ~riscv x86"" + 20 IUSE=""gles2-only semantic-desktop v4l"" + 21 + 22 RESTRICT=""test"" # segfaults, bug 684132 + 23 + 24 DEPEND="" + 25 >=dev-qt/qtconcurrent-${QTMIN}:5 + 26 >=dev-qt/qtdbus-${QTMIN}:5 + 27 >=dev-qt/qtdeclarative-${QTMIN}:5[widgets] + 28 >=dev-qt/qtgui-${QTMIN}:5[gles2-only=] + 29 >=dev-qt/qtmultimedia-${QTMIN}:5 + 30 >=dev-qt/qtnetwork-${QTMIN}:5 + 31 >=dev-qt/qtnetworkauth-${QTMIN}:5 + 32 >=dev-qt/qtquickcontrols2-${QTMIN}:5 + 33 >=dev-qt/qtsvg-${QTMIN}:5 + 34 >=dev-qt/qtwidgets-${QTMIN}:5 + 35 >=dev-qt/qtxml-${QTMIN}:5 + 36 >=kde-frameworks/karchive-${KFMIN}:5 + 37 >=kde-frameworks/kbookmarks-${KFMIN}:5 + 38 >=kde-frameworks/kcodecs-${KFMIN}:5 + 39 >=kde-frameworks/kcompletion-${KFMIN}:5 + 40 >=kde-frameworks/kconfig-${KFMIN}:5 + 41 >=kde-frameworks/kconfigwidgets-${KFMIN}:5 + 42 >=kde-frameworks/kcoreaddons-${KFMIN}:5 + 43 >=kde-frameworks/kcrash-${KFMIN}:5 + 44 >=kde-frameworks/kdbusaddons-${KFMIN}:5 + 45 >=kde-frameworks/kdeclarative-${KFMIN}:5 + 46 >=kde-frameworks/kfilemetadata-${KFMIN}:5 + 47 >=kde-frameworks/kguiaddons-${KFMIN}:5 + 48 >=kde-frameworks/ki18n-${KFMIN}:5 + 49 >=kde-frameworks/kiconthemes-${KFMIN}:5 + 50 >=kde-frameworks/kio-${KFMIN}:5 + 51 >=kde-frameworks/kitemviews-${KFMIN}:5 + 52 >=kde-frameworks/kjobwidgets-${KFMIN}:5 + 53 >=kde-frameworks/knewstuff-${KFMIN}:5 + 54 >=kde-frameworks/knotifications-${KFMIN}:5 + 55 >=kde-frameworks/knotifyconfig-${KFMIN}:5 + 56 >=kde-frameworks/kservice-${KFMIN}:5 + 57 >=kde-frameworks/ktextwidgets-${KFMIN}:5 + 58 >=kde-frameworks/kwidgetsaddons-${KFMIN}:5 + 59 >=kde-frameworks/kxmlgui-${KFMIN}:5 + 60 >=kde-frameworks/purpose-${KFMIN}:5 + 61 >=kde-frameworks/solid-${KFMIN}:5 + 62 >=media-libs/mlt-7.14.0[ffmpeg,frei0r,qt5,sdl,xml] + 63 v4l? ( media-libs/libv4l ) + 64 "" + 65 RDEPEND=""${DEPEND} + 66 >=dev-qt/qtquickcontrols-${QTMIN}:5 + 67 media-video/ffmpeg[encode,libass,sdl,X] + 68 media-video/mediainfo + 69 "" + 70 BDEPEND=""sys-devel/gettext"" + 71 + 72 src_configure() { + 73 local mycmakeargs=( + 74 $(cmake_use_find_package v4l LibV4L2) + 75 ) + 76 ecm_src_configure + 77 } + 78 + 79 pkg_postinst() { + 80 ecm_pkg_postinst + 81 optfeature ""VP8 and VP9 codec support"" ""media-video/ffmpeg[vpx]"" + 82 } +jlpoole@eos ~/work/kdenlive $ +" +sNanJFDk,4 Lines of Text SVG Sample,jlpoole,XML,Saturday 9th of December 2023 10:27:50 AM CDT," + + + + + + + This is line 1.This is line 2This is line 3This is line 4 + + +" +rtS5L3Yh,AoC 2023 Day 09,illuminati229,Python,Saturday 9th of December 2023 10:24:59 AM CDT,"from time import time + + +def timer_func(func): + # This function shows the execution time of + # the function object passed + def wrap_func(*args, **kwargs): + t1 = time() + result = func(*args, **kwargs) + t2 = time() + print(f'Function {func.__name__!r} executed in {(t2 - t1):.4f}s') + return result + + return wrap_func + + +def difference(a: list): + if len(a) == 1: + return [] + b = [] + for i, x in enumerate(a[:-1]): + b.append(a[i+1] - x) + return b + + +def is_constant(a): + c = a[0] + for x in a[1:]: + if x != c: + return False + return True + + +def next_value(a): + d = difference(a) + if is_constant(d): + return a[-1] + d[0] + else: + return a[-1] + next_value(d) + + +def prior_value(a): + d = difference(a) + if is_constant(d): + return a[0] - d[0] + else: + return a[0] - prior_value(d) + + +@timer_func +def day09(filepath, part2=False): + with open(filepath) as fin: + lines = [line.strip() for line in fin.readlines()] + + hist_sum = 0 + if not part2: + for line in lines: + hist_sum += next_value([int(x) for x in line.split()]) + else: + for line in lines: + hist_sum += prior_value([int(x) for x in line.split()]) + + return hist_sum + + +def main(): + assert day09('test09') == 114 + print(f""Part 1: {day09('input09')}"") + + assert day09('test09', True) == 2 + print(f""Part 2: {day09('input09', True)}"") + + +if __name__ == '__main__': + main() +" +DTiDTgQ9,Untitled,Shiny_,C++,Saturday 9th of December 2023 10:17:01 AM CDT,"// LD_CharacterFunctionLibrary.h + +#pragma once + +#include ""CoreMinimal.h"" +#include ""Kismet/BlueprintFunctionLibrary.h"" +#include ""GameFramework/CharacterMovementComponent.h"" +#include ""LD_CharacterFunctionLibrary.generated.h"" + +UCLASS() +class LD_API ULD_CharacterFunctionLibrary : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() + +public: + UFUNCTION(BlueprintCallable, Category = ""Character Movement"") + static void SmoothSprinting( + UCharacterMovementComponent* CharMovementComp, + bool bIsSprinting, + float DeltaTime, + float AccelerationTime, + float DecelerationTime, + float WalkingSpeed, + float SprintingSpeed, + float& Alpha, + bool& bWasSprinting, + float& TimeSinceMaxSpeedReached + ); +}; + + + +// LD_CharacterFunctionLibrary.cpp + +#include ""LD_CharacterFunctionLibrary.h"" + +// Declare static variables for debug purposes +static float DebugAccumulatedDeltaTime = 0.0f; +static float DebugAccumulatedAlpha = 0.0f; +static int32 CallCount = 0; + +void ULD_CharacterFunctionLibrary::SmoothSprinting( + UCharacterMovementComponent* CharMovementComp, + bool bIsSprinting, + float DeltaTime, + float AccelerationTime, + float DecelerationTime, + float WalkingSpeed, + float SprintingSpeed, + float& Alpha, + bool& bWasSprinting, + float& TimeSinceMaxSpeedReached) +{ + if (!CharMovementComp) return; + + // Update Alpha based on whether we are sprinting or not + if (bIsSprinting != bWasSprinting) + { + Alpha = bIsSprinting ? 0.0f : 1.0f; + bWasSprinting = bIsSprinting; + TimeSinceMaxSpeedReached = 0.0f; + } + + if (bIsSprinting) + { + // Accelerate towards the sprinting speed + Alpha = FMath::Clamp(Alpha + (DeltaTime / AccelerationTime), 0.0f, 1.0f); + } + else + { + // Decelerate towards the walking speed + Alpha = FMath::Clamp(Alpha - (DeltaTime / DecelerationTime), 0.0f, 1.0f); + } + + float NewSpeed = FMath::InterpEaseInOut(WalkingSpeed, SprintingSpeed, Alpha, 2.0f); + CharMovementComp->MaxWalkSpeed = NewSpeed; + + // Debug logging for DeltaTime accumulation over 10 seconds +// #if UE_BUILD_DEVELOPMENT || UE_BUILD_DEBUG + DebugAccumulatedDeltaTime += DeltaTime; + DebugAccumulatedAlpha += (DeltaTime / AccelerationTime); + + if (GEngine) + { + GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT(""DeltaTime: %f, Alpha: %f""), DeltaTime, Alpha)); + } + + /* if (GEngine && DebugAccumulatedDeltaTime >= 10.0f) + { + CallCount++; + + // On-screen debug messages + GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT(""Function called %d times, DeltaTime: %f, Accumulated Alpha: %f""), CallCount, DeltaTime, DebugAccumulatedAlpha)); + + // Prepare log text + FString LogText = FString::Printf(TEXT(""Alpha: %f, Sprinting: %s, Speed: %f, DeltaTime: %f\n""), + Alpha, + bIsSprinting ? TEXT(""True"") : TEXT(""False""), + CharMovementComp->MaxWalkSpeed, + DeltaTime); + + // Define a log file name with a complete path + FString LogFilename = FPaths::ProjectDir() + TEXT(""Log/SprintLog.txt""); + + // Append the log text to the file + FFileHelper::SaveStringToFile(LogText, *LogFilename, FFileHelper::EEncodingOptions::AutoDetect, &IFileManager::Get(), FILEWRITE_Append); + + // Reset the accumulated time and alpha + DebugAccumulatedDeltaTime = 0.0f; + DebugAccumulatedAlpha = 0.0f; + }*/ +// #endif + bWasSprinting = bIsSprinting; +} + + + + +// LD_Character.h + +#pragma once + +#include ""CoreMinimal.h"" +#include ""GameFramework/Character.h"" +#include ""LD_Character.generated.h"" + +UCLASS() +class LD_API ALD_Character : public ACharacter +{ + GENERATED_BODY() + +public: + ALD_Character(); + + virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; + + // Functions to handle sprinting input + UFUNCTION(BlueprintCallable, Category = ""Character Movement"") + void StartSprinting(); + + UFUNCTION(BlueprintCallable, Category = ""Character Movement"") + void StopSprinting(); + + void EndGracePeriod(); + + + UFUNCTION() + void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit); + + // Function to be called by the timer + UFUNCTION(BlueprintCallable, Category = ""Character Movement"") + void UpdateSprintState(); + + virtual void Tick(float DeltaTime) override; + + // Movement parameters + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ""Character Movement"") + float WalkingSpeed = 600.0f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ""Character Movement"") + float SprintingSpeed = 10000.0f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ""Character Movement"") + float AccelerationTime = 10.0f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = ""Character Movement"") + float DecelerationTime = 2.0f; + + // Sprint state variables + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = ""Character Movement"") + float Alpha = 0.0f; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = ""Character Movement"") + bool bWasSprinting = false; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = ""Character Movement"") + float TimeSinceMaxSpeedReached = 0.0f; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = ""Character Movement"") + FVector LastForwardVector; + +private: + FTimerHandle DecelerationTimerHandle; + + static constexpr float GracePeriodDuration = 0.5f; + bool bWithinGracePeriod = false; + FTimerHandle GracePeriodTimerHandle; + + bool bHasCollided = false; // Flag to indicate a recent collision + + bool bIsSprinting = false; + + FTimerHandle SprintTimerHandle; + + bool bSprintKeyPressed = false; + + float SprintingTime; + + void DecelerateCharacter(); + + virtual void Landed(const FHitResult& Hit) override; + +// virtual void NotifyHit(class UPrimitiveComponent* MyComp, AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit) override; + + void StartDeceleration(); +}; + + + + +// LD_Character.cpp + +#include ""LD_Character.h"" +#include ""LD_CharacterFunctionLibrary.h"" +#include ""Components/CapsuleComponent.h"" + +ALD_Character::ALD_Character() +{ + PrimaryActorTick.bCanEverTick = true; + LastForwardVector = GetActorForwardVector(); + GetCapsuleComponent()->OnComponentHit.AddDynamic(this, &ALD_Character::OnHit); +} + +void ALD_Character::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) +{ + Super::SetupPlayerInputComponent(PlayerInputComponent); + PlayerInputComponent->BindAction(""Sprint"", IE_Pressed, this, &ALD_Character::StartSprinting); + PlayerInputComponent->BindAction(""Sprint"", IE_Released, this, &ALD_Character::StopSprinting); +} + +void ALD_Character::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + if (bSprintKeyPressed && !bIsSprinting && GetCharacterMovement()->Velocity.Size() >= WalkingSpeed) + { + StartSprinting(); + } + + // If sprinting, increment the sprinting time + if (bIsSprinting) + { + SprintingTime += DeltaTime; + } + + if (GEngine && bIsSprinting) + { + GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT(""Sprinting Time: %f""), SprintingTime)); + } + +} + +void ALD_Character::StartSprinting() +{ + float CurrentSpeed = GetCharacterMovement()->Velocity.Size(); + if (CurrentSpeed >= WalkingSpeed) + { + bIsSprinting = true; + if (!bWithinGracePeriod) + { + Alpha = FMath::Clamp(CurrentSpeed / SprintingSpeed, 0.0f, 1.0f); + } + GetWorldTimerManager().SetTimer(SprintTimerHandle, this, &ALD_Character::UpdateSprintState, 0.01f, true); + bWithinGracePeriod = false; + } + bSprintKeyPressed = true; + SprintingTime = 0.0f; // Reset the sprinting timer +} + +void ALD_Character::StopSprinting() +{ + bSprintKeyPressed = false; + GetWorldTimerManager().SetTimer(GracePeriodTimerHandle, this, &ALD_Character::EndGracePeriod, GracePeriodDuration, false); +} + +void ALD_Character::EndGracePeriod() +{ + bWithinGracePeriod = false; + if (!bSprintKeyPressed && bIsSprinting) + { + bIsSprinting = false; + StartDeceleration(); + } +} + +void ALD_Character::Landed(const FHitResult& Hit) +{ + Super::Landed(Hit); + if (bSprintKeyPressed) + { + StartSprinting(); + } + else + { + StartDeceleration(); + } +} + +void ALD_Character::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) +{ + bHasCollided = true; + + StartDeceleration(); +} + +void ALD_Character::UpdateSprintState() +{ + // Handle the case where the character has collided + if (bHasCollided) + { + // If the character has collided, handle the deceleration or stop sprinting as needed + if (!GetWorldTimerManager().IsTimerActive(DecelerationTimerHandle)) + { + StartDeceleration(); + } + + // Reset the collision flag + bHasCollided = false; + return; // Exit early to prevent further sprint logic + } + + if (!bSprintKeyPressed && bIsSprinting) + { + bIsSprinting = false; + StartDeceleration(); + } + + if (!bIsSprinting) + { + return; + } + + float DeltaTime = GetWorld()->GetDeltaSeconds(); + FVector CurrentVelocity = GetCharacterMovement()->Velocity; + float CurrentSpeed = CurrentVelocity.Size(); + + if (CurrentSpeed >= WalkingSpeed) + { + ULD_CharacterFunctionLibrary::SmoothSprinting( + GetCharacterMovement(), + bIsSprinting, + DeltaTime, + AccelerationTime, + DecelerationTime, + WalkingSpeed, + SprintingSpeed, + Alpha, + bWasSprinting, + TimeSinceMaxSpeedReached + ); + } + else + { + StartDeceleration(); + } +} + +void ALD_Character::StartDeceleration() +{ + if (!GetWorldTimerManager().IsTimerActive(DecelerationTimerHandle)) + { + // GetWorldTimerManager().SetTimer(DecelerationTimerHandle, this, &ALD_Character::DecelerateCharacter, GetWorld()->GetDeltaSeconds(), true); + GetWorldTimerManager().SetTimer(DecelerationTimerHandle, this, &ALD_Character::DecelerateCharacter, 0.01f, true); + } +} + +void ALD_Character::DecelerateCharacter() +{ + if (!bIsSprinting && Alpha > 0.0f) + { + // Alpha -= GetWorld()->GetDeltaSeconds() / DecelerationTime; + Alpha -= 0.01f / DecelerationTime; // Adjust this rate as needed for smoother deceleration + Alpha = FMath::Clamp(Alpha, 0.0f, 1.0f); + float NewSpeed = FMath::Lerp(SprintingSpeed, WalkingSpeed, 1.0f - Alpha); + GetCharacterMovement()->MaxWalkSpeed = NewSpeed; + } + + if (Alpha <= 0.0f) + { + GetWorldTimerManager().ClearTimer(DecelerationTimerHandle); + } +} +" +qHzLwWXm,logic back button,Arexils,Python,Saturday 9th of December 2023 10:01:34 AM CDT,"class BackButton(miru.Button): + def __init__(self, *args, **kwargs) -> None: + super().__init__( + label=kwargs.pop('label', 'Back'), + style=hikari.ButtonStyle.PRIMARY, + *args, + **kwargs, + ) + + async def callback(self, ctx: miru.ViewContext, **kwargs) -> None: + # How do I make it go back to the beginning? + ... + + +class BuildOptionButton(miru.Button): + def __init__(self, *args, **kwargs) -> None: + super().__init__( + *args, + **kwargs, + style=hikari.ButtonStyle.PRIMARY, + ) + + async def callback(self, ctx: miru.ViewContext, **kwargs) -> None: + ... + + view_select = miru.View(timeout=300) + view_select.add_item(BackButton()) # <-- this button for back view + msg = await ctx.message.edit(embed, components=view_select) + await view_select.start(msg) + await view_select.wait() + + ... + + +class AccountBaseMenu(miru.View): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.add_item(BuildOptionButton(label='add some') + self.add_item(BuildOptionButton(label='add other') + + @miru.button(label='Apply', style=hikari.ButtonStyle.SUCCESS, row=2) + async def accept_button(self, button: miru.Button, ctx: miru.ViewContext) -> None: + ... + + @miru.button(label='Cancel', style=hikari.ButtonStyle.DANGER, row=2) + async def cancel_button(self, button: miru.Button, ctx: miru.ViewContext) -> None: + ... + +@bot.command() +@lightbulb.command( + 'add_user', + 'add user', + auto_defer=True, + pass_options=True, +) +@lightbulb.implements(lightbulb.SlashCommand) +async def add_user(ctx: lightbulb.Context): + ... code DB ... + view_first = AccountBaseMenu(timeout=300) + message = await ctx.respond( + Embed( + title=f'{name}', + description=('some text'), + ), + components=view_first, + ) + await view_first.start(message) + await view_first.wait() + ... next code" +PazdaPF6,Untitled,Ilya_Bykonya,Arduino,Saturday 9th of December 2023 09:36:49 AM CDT,"#include ""ModbusRtu.h"" +#define ID 1 // адрес ведомого + +//Задаём ведомому адрес, последовательный порт, выход управления TX +Modbus slave(ID, 0, 0); + +constexpr uint8_t all_registers_count = 29; +uint16_t all_registers[all_registers_count]{}; +#define TIME_L 5 + +// write + // service: [0, 1] + // controls: [lining, right/left lifting] + // indicators: [...] +// read + // sensors + + +// write[<=12] + // service: [0, 1] + // controls: [2, 3, 4] + // indicators: [5, 6, 7, 8, 9, 10] +// read[>12] + // sensors [12, 13, 14, ..., 28] + + + + + + +// service: 0, 1 +// write +// read +int i = 0; + +void setup() { + // настраиваем последовательный порт ведомого + slave.begin(115200); +} + +void loop() { + static unsigned long prev_time{}; + unsigned long cur_time = millis(); + if (cur_time - prev_time > TIME_L) { + i++; + prev_time = cur_time; + } + if (prev_time > cur_time) prev_time = cur_time; + int8_t state = slave.poll(all_registers, all_registers_count); + io_poll(); +} + +void io_poll() { + const uint16_t register_number_data = all_registers[0];//holding + all_registers[1] = register_number_data * 2;//input + const bool register_flag_data = all_registers[2];//coil + all_registers[3] = !register_flag_data;//discrete input +} +" +bbVzmK1e,c-loadproject.php,Rachmannh,PHP,Saturday 9th of December 2023 09:36:11 AM CDT," + + + + + + + + + + + + Load Project - Consultant + + + + + + + + + + + + +
+ + + + + + +
+ + +
+ + + + + + +
+ + +

Load Project

+ +
+ + +
+ + +
+
+
Load Existing Project
+
+
+ +
+ + + + + + + + + + + + $datas) : ?> + + + + + + + + + + +
Project IDNama perusahaanTanggal MulaiTanggal SelesaiActions
+ +
+
+
+
+ +
+ +
+ + + +
+
+
+ Copyright © Your Website 2020 +
+
+
+ + +
+ + +
+ + + + + + + + +
+
+
+
+
Ready to Leave?
+ +
+
Select ""Logout"" below if you are ready to end your current session.
+
+ + Logout +
+
+
+
+ + + + + + + + + + + + + +" +HQGg5YrJ,c-topbar.php,Rachmannh,PHP,Saturday 9th of December 2023 09:35:19 AM CDT," + + + + + + +
+
+
+
+
Ready to Leave?
+ +
+
Select ""Logout"" below if you are ready to end your current session.
+
+ + Logout +
+
+
+
" +epS7reKw,indexcst.php,Rachmannh,PHP,Saturday 9th of December 2023 09:34:53 AM CDT,"query($totalProjects); +if ($hasilproject) { + $row = $hasilproject->fetch_assoc(); + $totalProjects = $row['total_projects']; +} + +$totalProCST = (""SELECT COUNT(*) AS total_procst FROM ttaccess where UID = 'CST01'""); +$hasilprocst = $con->query($totalProCST); +if ($hasilprocst) { + $row = $hasilprocst->fetch_assoc(); + $totalProCST = $row['total_procst']; +} +$totalcst = (""SELECT COUNT(*) AS totalcst FROM tmuserlogin WHERE usergroup = 'consultant'""); +$hasilcst = $con->query($totalcst); +if ($hasilcst) { + $row = $hasilcst->fetch_assoc(); + $totalcst = $row['totalcst']; +} + +$totalPC = (""SELECT COUNT(*) AS total_pc FROM tmuserlogin WHERE usergroup = 'pc'""); +$hasilpc = $con->query($totalPC); +if ($hasilpc) { + $row = $hasilpc->fetch_assoc(); + $totalPC = $row['total_pc']; +} + +?> + + + + + + + + + + + + Dashboard - Admin + + + + + + + + + + + + + +
+ + + + +
+ + +
+ + + + + + +
+ + +

Dashboard

+
+ + +
+ +
+ + +
+
+
+
+
+
+ Total Proyek
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ Total Proyek Saya
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ Jumlah Konsultan
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ Jumlah Project Coordinator
+
+
+
+ +
+
+
+
+
+
+
+ +
+ + + +
+
+
+ Copyright © Your Website 2020 +
+
+
+ +
+ + +
+ + + + + + + + +
+
+
+
+
Ready to Leave?
+ +
+
Select ""Logout"" below if you are ready to end your current session.
+
+ + Logout +
+
+
+
+ + + + + + + + + + + + + +" +5zvuLd5s,Tupie kusti,az4x,Python,Saturday 9th of December 2023 09:29:28 AM CDT,"def get_data(): + file = open(""INPUT.TXT"", ""r"") + data = file.readlines()[1:] + file.close() + + return """".join(data) + + +def process(data): + bushes = list(map(int, data.split())) + bushes.extend([bushes[0], bushes[1]]) + + m = 0 + for i in range(1, len(bushes) - 1): + s = bushes[i - 1] + bushes[i] + bushes[i + 1] + if s > m: + m = s + + return m + + +def save_data(data): + file = open(""OUTPUT.txt"", ""w"") + file.write(str(data)) + file.close() + + +x = get_data() +y = process(x) +save_data(y) +" +KE8kb1Xq,Untitled,poxipox,Lua,Saturday 9th of December 2023 09:22:12 AM CDT,"local configQuest = { -- configQuest.mission[1].storage + mission = { + [50002] = { -- actionID + storage = 50000, + IDstorage = 2, + text = ""Nie znalazles wszystkich dzwigni, wracaj!"", + }, + }, +} + + +function onStepIn(cid, item, pos, fromPos) + + if isPlayer(cid) ~= TRUE then + return true + end + + local misionId = configQuest.mission[item.actionid] + if misionId then + if getPlayerStorageValue(cid, misionId.storage) == misionId.IDstorage then + doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ""Hell Mission: "") + else + doTeleportThing(cid, fromPos, true) + doPlayerSendCancel(cid, misionId.text) + return true + end + end + return true +end + +" +vJeQb5Dy,BDOT 4/5,MARSHAL327,Scala,Saturday 9th of December 2023 09:19:28 AM CDT,"package sevsu.spark + +import java.nio.file.Paths +import org.apache.spark.{RangePartitioner, SparkConf, SparkContext} +import org.apache.spark.rdd.RDD +import sevsu.spark.Application.time + +object Application { + private val conf: SparkConf = new SparkConf() + .setMaster(""local[*]"") + .setAppName(""spark_example"") + .set(""spark.ui.showConsoleProgress"", ""false"") + + private val sc: SparkContext = getSparkContext(conf) + + private val resourcesRoot: String = this.getClass.getResource(""/"").toString + private val personPath: String = resourcesRoot + ""person.csv"" + private val apartmentPath: String = resourcesRoot + ""apartment.csv"" + + case class Person(id: Int, name: String) + + case class Apartment(id_apartment: Int, id_human: Int, num_rooms: Int, address: String) + + def time[R](block: => R): R = { + val t0 = System.nanoTime() + val result = block // call-by-name + val t1 = System.nanoTime() + val resultTime = BigDecimal((t1 - t0) / Math.pow(10, 9)) + .setScale(4, BigDecimal.RoundingMode.HALF_UP) + println(""Время: "" + resultTime + "" сек."") + result + } + + def lab4(apartments: RDD[Apartment], persons: RDD[Person], printResults: Boolean = true): Unit = { + println(""========== lab4 =========="") + // ====== Task 1 ====== + val personCounter: RDD[(Int, Int)] = apartments.map(item => (item.id_human, 1)) + val numPersonApartments = + personCounter + .reduceByKey((a, b) => a + b) + .persist() + val numApartmentsPerson = + numPersonApartments + .map(_.swap) + .groupByKey() + .sortByKey() + + if (printResults) { + println(numApartmentsPerson.collect().mkString(""\n"")) + } + + print(""1 задание - "") + time(numApartmentsPerson.collect()) + + + // ====== Task 2 ====== + val personPairRDD = persons.map(item => (item.id, item.name)) + val joined = personPairRDD join numPersonApartments + val numPersonNameApartments = joined.map(item => item._2) + + if (printResults) { + println(numPersonNameApartments.collect().mkString(""\n"")) + } + + print(""2 задание - "") + time(numPersonNameApartments.collect()) + + + // ====== Task 3 ====== + val personApartmentsAddress = apartments + .filter(_.num_rooms > 2) + .map(item => + (item.id_human, item.address) + ) + val personNameAddressWithId = personApartmentsAddress join personPairRDD + val personNameAddress = personNameAddressWithId.map(item => item._2) + + if (printResults) { + println(personNameAddress.collect().mkString(""\n"")) + } + + print(""3 задание - "") + time(personNameAddress.collect()) + } + + def lab5(apartments: RDD[Apartment], persons: RDD[Person], printResults: Boolean = true): Unit = { + println(""\n========== lab5 =========="") + + // ====== Task 1 ====== + val pairApartments = apartments.map(apartment => (apartment.id_human, 1)) + + val partitioner = new RangePartitioner(4, pairApartments) + val partitionedPairApartments = pairApartments.partitionBy(partitioner).persist() + + val numPersonApartments = + partitionedPairApartments + .reduceByKey((a, b) => a + b) + .persist() + val numApartmentsPerson = + numPersonApartments + .map(_.swap) + .groupByKey() + .sortByKey() + + if (printResults) { + println(numApartmentsPerson.collect().mkString(""\n"")) + } + + print(""1 задание - "") + time(numApartmentsPerson.collect()) + + + // ====== Task 2 ====== + val personPairRDD = persons.map(item => (item.id, item.name)) + + val partitionerPersonPairRDD = new RangePartitioner(4, personPairRDD) + val partitionedPersonPairRDD = personPairRDD.partitionBy(partitionerPersonPairRDD).persist() + + val joined: RDD[(Int, (String, Int))] = partitionedPersonPairRDD join numPersonApartments + val numPersonNameApartments = joined.mapValues(item => item._1) + + if (printResults) { + println(numPersonNameApartments.collect().mkString(""\n"")) + } + + print(""2 задание - "") + time(numPersonNameApartments.collect()) + + + // ====== Task 3 ====== + val personApartmentsAddress = apartments + .filter(_.num_rooms > 2) + .map(item => + (item.id_human, item.address) + ) + + val partitionerPersonApartmentsAddress = new RangePartitioner(4, personApartmentsAddress) + val partitionedPersonApartmentsAddress = personApartmentsAddress.partitionBy(partitionerPersonApartmentsAddress).persist() + + val personNameAddressWithId = partitionedPersonApartmentsAddress join personPairRDD + val personNameAddress = personNameAddressWithId.mapValues(item => item._1) + + if (printResults) { + println(personNameAddress.collect().mkString(""\n"")) + } + + print(""3 задание - "") + time(personNameAddress.collect()) + } + + def main(args: Array[String]): Unit = { + val rawPersonRdd: RDD[String] = sc.textFile(personPath) + val rawApartmentRdd: RDD[String] = sc.textFile(apartmentPath) + val persons: RDD[Person] = rawPersonRdd.map(strPerson => { + strPerson.split("","").map(_.trim) match { + case Array(id, name) => Person(id.toInt, name) + } + }) + val apartments: RDD[Apartment] = rawApartmentRdd.map(strPerson => { + strPerson.split("","").map(_.trim) match { + case Array(id_apartment, id_human, num_rooms, address) => Apartment(id_apartment.toInt, id_human.toInt, num_rooms.toInt, address) + } + }) + + time(lab4(apartments, persons, printResults = false)) + time(lab5(apartments, persons, printResults = false)) + + sc.stop() + } + + private def getSparkContext(conf: SparkConf): SparkContext = { + if (System.getProperty(""os.name"").toLowerCase.contains(""windows"")) { + System.setProperty( + ""hadoop.home.dir"", + Paths.get(this.getClass.getResource(""/winutils/hadoop-2.7.1/"").toURI).toString + ) + } + + new SparkContext(conf) + } +} +" +rSfMYu2N,Untitled,HariBG,C++,Saturday 9th of December 2023 08:53:15 AM CDT,"#include + +int main() { + + // Creating array + int arr[] { 3,5,2,4,6,9,7,8,1,6,9,7,1,8,5,9,3,2,8,9,1,2,7,3,6,5,4,1, + 3,9,6,4,2,5,7,8,4,6,5,8,4,7,2,1,3,2,7,8,5,3,1,4,9,6,9,2,4,5,1,8, + 3,6,7,5,1,3,9,2,6,8,4,7,7,8,6,3,5,4,1,2,9 }; + + // find size of array + int arr_size = sizeof(arr) / sizeof(arr[0]); + + if (arr_size != 81) { + std::cout << ""Incorrect number of numbers! It should be exactly 81."" << std::endl; + return 0; + } + + // Printing array in 9x9 + int separator = 0; + int row = 0; + + for (int i = 0; i < 81; ++i) { + std::cout << arr[i] << "" ""; + separator++; + + if (separator == 9) { + std::cout << std::endl; + row++; + separator = 0; + } + + if (separator == 3 || separator == 6) { + std::cout << ""|""; + } + + if (row == 3) { + std::cout << ""-------------------""; + std::cout << std::endl; + row = 0; + } + } + + std::cout << std::endl; + + return 0; +} +"