├── README.md
├── keylogger.cpp
├── ghadaam-layout.c++
├── perl-main.pl
├── Dockerfile
├── Resources.Designer.cs
├── route.cs
└── docker-compose.yml
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/keylogger.cpp:
--------------------------------------------------------------------------------
1 | version: '3.8'
2 |
3 | networks:
4 |
5 | secrets:
6 |
7 | x-service-defaults:
8 |
9 | x-pg-secrets:
10 |
11 | x-pg-secrets-env:
12 |
13 | services:
14 |
--------------------------------------------------------------------------------
/ghadaam-layout.c++:
--------------------------------------------------------------------------------
1 | # syntax=docker/dockerfile:1
2 |
3 | FROM node:18-alpine
4 | WORKDIR /app
5 | COPY . .
6 | RUN yarn install --production
7 | CMD ["node", "src/index.js"]
8 | EXPOSE 3000
9 |
--------------------------------------------------------------------------------
/perl-main.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 |
3 | @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
4 | @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
5 | ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
6 | $year = 1900 + $yearOffset;
7 | $theTime = "$weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year";
8 |
9 | print "Content-type: text/html\n\n";
10 | print <
12 |
13 | A Simple Perl CGI
14 |
15 |
16 | A Simple Perl CGI
17 | $theTime
18 |
19 | HTML
20 | exit;
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:20-slim AS base
2 |
3 | ## Sharp dependencies, copy all the files for production
4 | FROM base AS sharp
5 | ENV PNPM_HOME="/pnpm"
6 | ENV PATH="$PNPM_HOME:$PATH"
7 | RUN corepack enable
8 |
9 | WORKDIR /app
10 |
11 | RUN pnpm add sharp
12 |
13 | ## Install dependencies only when needed
14 | FROM base AS builder
15 | ENV PNPM_HOME="/pnpm"
16 | ENV PATH="$PNPM_HOME:$PATH"
17 | RUN corepack enable
18 |
19 | WORKDIR /app
20 |
21 | COPY package.json ./
22 |
23 | # If you want to build docker in China
24 | # RUN npm config set registry https://registry.npmmirror.com/
25 | RUN pnpm i
26 |
27 | COPY . .
28 | RUN pnpm run build:docker # run build standalone for docker version
29 |
30 | ## Production image, copy all the files and run next
31 | FROM base AS runner
32 | WORKDIR /app
33 |
34 | ENV NODE_ENV production
35 |
36 | RUN addgroup --system --gid 1001 nodejs
37 | RUN adduser --system --uid 1001 nextjs
38 |
39 | COPY --from=builder /app/public ./public
40 |
41 | # Set the correct permission for prerender cache
42 | RUN mkdir .next
43 | RUN chown nextjs:nodejs .next
44 |
45 | # Automatically leverage output traces to reduce image size
46 | # https://nextjs.org/docs/advanced-features/output-file-tracing
47 | COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
48 | COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
49 | COPY --from=sharp --chown=nextjs:nodejs /app/node_modules/.pnpm ./node_modules/.pnpm
50 |
51 | USER nextjs
52 |
53 | EXPOSE 3210
54 |
55 | # set hostname to localhost
56 | ENV HOSTNAME "0.0.0.0"
57 | ENV PORT=3210
58 |
59 | # General Variables
60 | ENV ACCESS_CODE ""
61 | ENV CUSTOM_MODELS ""
62 |
63 | # OpenAI
64 | ENV OPENAI_API_KEY ""
65 | ENV OPENAI_PROXY_URL ""
66 |
67 | # Azure OpenAI
68 | ENV USE_AZURE_OPENAI ""
69 | ENV AZURE_API_KEY ""
70 | ENV AZURE_API_VERSION ""
71 |
72 | # Google
73 | ENV GOOGLE_API_KEY ""
74 |
75 | # Zhipu
76 | ENV ZHIPU_API_KEY ""
77 |
78 | # Moonshot
79 | ENV MOONSHOT_API_KEY ""
80 |
81 | # Ollama
82 | ENV OLLAMA_PROXY_URL ""
83 |
84 | CMD ["node", "server.js"]
85 |
--------------------------------------------------------------------------------
/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.239
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HowTo.Multithreading.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HowTo.Multithreading.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/route.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2002 Microsoft Corporation
2 | //All rights reserved.
3 | //THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
4 | //EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
5 | //MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
6 | //Requires the Trial or Release version of Visual Studio .NET Professional (or greater).
7 |
8 | using System;
9 |
10 | public class frmTaskProgress : System.Windows.Forms.Form
11 | {
12 |
13 | #region " Windows Form Designer generated code "
14 |
15 | public frmTaskProgress()
16 | {
17 | //This call is required by the Windows Form Designer.
18 | InitializeComponent();
19 | //Add any initialization after the InitializeComponent() call
20 | }
21 |
22 | //Form overrides dispose to clean up the component list.
23 | protected override void Dispose(bool disposing)
24 | {
25 | if(disposing)
26 | {
27 | if (components != null) {
28 | components.Dispose();
29 | }
30 | }
31 |
32 | base.Dispose(disposing);
33 | }
34 |
35 | //Required by the Windows Form Designer
36 | private System.ComponentModel.IContainer components;
37 |
38 | //NOTE: The following procedure is required by the Windows Form Designer
39 | //It can be modified using the Windows Form Designer.
40 | //Do not modify it using the code editor.
41 |
42 | public System.Windows.Forms.ProgressBar prgTaskProgress;
43 | private System.Windows.Forms.Label lblLengthyTask;
44 | private System.Windows.Forms.Label lblThreadID;
45 |
46 | private void InitializeComponent()
47 | {
48 | System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmTaskProgress));
49 |
50 | this.prgTaskProgress = new System.Windows.Forms.ProgressBar();
51 | this.lblLengthyTask = new System.Windows.Forms.Label();
52 | this.lblThreadID = new System.Windows.Forms.Label();
53 | this.SuspendLayout();
54 |
55 | //
56 | //prgTaskProgress
57 | //
58 | this.prgTaskProgress.Location = new System.Drawing.Point(32, 40);
59 | this.prgTaskProgress.Name = "prgTaskProgress";
60 | this.prgTaskProgress.Size = new System.Drawing.Size(216, 24);
61 | this.prgTaskProgress.TabIndex = 0;
62 | //
63 | //lblLengthyTask
64 | //
65 | this.lblLengthyTask.Font = new System.Drawing.Font("Microsoft Sans Serif", (float) 8.25, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte) 0);
66 | this.lblLengthyTask.Location = new System.Drawing.Point(56, 72);
67 | this.lblLengthyTask.Name = "lblLengthyTask";
68 | this.lblLengthyTask.Size = new System.Drawing.Size(184, 16);
69 | this.lblLengthyTask.TabIndex = 1;
70 | this.lblLengthyTask.Text = "Executing some lengthy task...";
71 | //
72 | //lblThreadID
73 | //
74 | this.lblThreadID.ImeMode = System.Windows.Forms.ImeMode.NoControl;
75 | this.lblThreadID.Location = new System.Drawing.Point(32, 8);
76 | this.lblThreadID.Name = "lblThreadID";
77 | this.lblThreadID.Size = new System.Drawing.Size(272, 24);
78 | this.lblThreadID.TabIndex = 5;
79 | this.lblThreadID.Text = "This window is being serviced by thread: ";
80 | //
81 | //frmTaskProgress
82 | //
83 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
84 | this.ClientSize = new System.Drawing.Size(292, 101);
85 | this.Controls.AddRange(new System.Windows.Forms.Control[] {this.lblThreadID, this.lblLengthyTask, this.prgTaskProgress});
86 | this.Icon = (System.Drawing.Icon) resources.GetObject("$this.Icon");
87 | this.Name = "frmTaskProgress";
88 | this.Text = "Task Progress";
89 | this.ResumeLayout(false);
90 | this.Load += new System.EventHandler(this.frmTaskProgress_Load);
91 | }
92 | #endregion
93 |
94 | private void frmTaskProgress_Load(object sender, System.EventArgs e)
95 | {
96 | //Display the ID of the thread that is loading this form.
97 | this.lblThreadID.Text += System.AppDomain.GetCurrentThreadId().ToString();
98 | }
99 | }
100 |
101 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.8'
2 |
3 | networks:
4 | rt-network:
5 | driver: bridge
6 |
7 | secrets:
8 | postgres_db:
9 | file: ./.secrets/postgres_db
10 | postgres_usr:
11 | file: ./.secrets/postgres_usr
12 | postgres_pass:
13 | file: ./.secrets/postgres_pass
14 | jwt_secret:
15 | file: ./.secrets/jwt_secret
16 | rfs_secret:
17 | file: ./.secrets/rfs_secret
18 |
19 | x-service-defaults:
20 | &service-defaults
21 | ulimits:
22 | core:
23 | soft: 0
24 | hard: 0
25 | restart: unless-stopped
26 | tty: true
27 | networks:
28 | - rt-network
29 |
30 | x-pg-secrets:
31 | &pg-secrets
32 | - postgres_db
33 | - postgres_usr
34 | - postgres_pass
35 |
36 | x-pg-secrets-env:
37 | &pg-secrets-env
38 | POSTGRES_DB_FILE: /run/secrets/postgres_db
39 | POSTGRES_USER_FILE: /run/secrets/postgres_usr
40 | POSTGRES_PASSWORD_FILE: /run/secrets/postgres_pass
41 |
42 |
43 | services:
44 | postgres:
45 | <<: *service-defaults
46 | image: postgres:13.2-alpine
47 | volumes:
48 | - ./storage/postgres:/var/lib/postgresql/data
49 | expose:
50 | - '5432'
51 | environment:
52 | <<: *pg-secrets-env
53 | TZ: UTC
54 | LANG: en_US.utf8
55 | secrets: *pg-secrets
56 |
57 | redis:
58 | <<: *service-defaults
59 | image: redis:6.0.5-alpine
60 | expose:
61 | - '6379'
62 | environment:
63 | TZ: UTC
64 | NODE_ENV: ${APP_ENV}
65 |
66 | elastic:
67 | <<: *service-defaults
68 | image: elasticsearch:8.6.2
69 | volumes:
70 | - ./storage/elastic:/usr/share/elasticsearch/data
71 | expose:
72 | - '9200'
73 | environment:
74 | TZ: UTC
75 | xpack.security.enabled: 'false'
76 | ingest.geoip.downloader.enabled: 'false'
77 | bootstrap.memory_lock: 'true'
78 | discovery.type: single-node
79 | ES_JAVA_OPTS: '-Xms512m -Xmx512m'
80 |
81 | api:
82 | &api
83 | <<: *service-defaults
84 | image: node:18-alpine
85 | user: node:node
86 | command: ['npm', 'run', '${API_CMD}']
87 | working_dir: /main
88 | volumes:
89 | - ./storage/api:/main/storage
90 | - ./shared-types:/shared-types
91 | - ./api:/main
92 | environment:
93 | TZ: UTC
94 | APP_TZ: ${APP_TZ}
95 | APP_CALENDAR: ${APP_CALENDAR}
96 | EXPOSED_PORT: 4500
97 | APP_DOMAIN: ${APP_DOMAIN}
98 | APP_PROTOCOL: ${APP_PROTOCOL}
99 | APP_TITLE: ${APP_TITLE}
100 | NODE_ENV: ${APP_ENV}
101 | SMS_SECRET: ${SMS_SECRET}
102 | SMS_TEMPLATE_VERIFY: ${SMS_TEMPLATE_VERIFY}
103 | SMS_TEMPLATE_NOTIFS: ${SMS_TEMPLATE_NOTIFS}
104 | SMS_FROM: ${SMS_FROM}
105 | SMS_USE_TEXT: ${SMS_USE_TEXT}
106 | ALLOW_EMAIL_AUTH: ${ALLOW_EMAIL_AUTH}
107 | GOOGLE_OAUTH_CLIENT_ID: ${GOOGLE_OAUTH_CLIENT_ID}
108 | expose:
109 | - '4500'
110 | depends_on:
111 | - postgres
112 | - elastic
113 | secrets:
114 | - postgres_db
115 | - postgres_usr
116 | - postgres_pass
117 | - jwt_secret
118 | - rfs_secret
119 |
120 | api_cron:
121 | <<: *api
122 | command: ['npm', 'run', 'cron']
123 | expose: []
124 |
125 | rfs:
126 | &rfs
127 | <<: *service-defaults
128 | image: node:18-alpine
129 | user: node:node
130 | command: ['npm', 'run', '${RFS_CMD}']
131 | working_dir: /main
132 | volumes:
133 | - ./storage/rfs:/main/storage
134 | - ./shared-types:/shared-types
135 | - ./rfs:/main
136 | environment:
137 | TZ: UTC
138 | APP_TZ: ${APP_TZ}
139 | EXPOSED_PORT: 3500
140 | APP_DOMAIN: ${APP_DOMAIN}
141 | APP_PROTOCOL: ${APP_PROTOCOL}
142 | APP_TITLE: ${APP_TITLE}
143 | NODE_ENV: ${APP_ENV}
144 | expose:
145 | - '3500'
146 | depends_on:
147 | - postgres
148 | secrets:
149 | - rfs_secret
150 |
151 | rfs_cron:
152 | <<: *rfs
153 | command: ['npm', 'run', 'cron']
154 | expose: []
155 |
156 | next:
157 | <<: *service-defaults
158 | image: node:18-alpine
159 | user: node:node
160 | command: ['npm', 'run', '${NEXT_CMD}']
161 | working_dir: /main
162 | volumes:
163 | - ./next:/main
164 | - ./shared-types:/shared-types
165 | environment:
166 | TZ: UTC
167 | EXPOSED_PORT: 3000
168 | NEXT_PUBLIC_APP_TZ: ${APP_TZ}
169 | NEXT_PUBLIC_APP_TITLE: ${APP_TITLE}
170 | NEXT_PUBLIC_APP_DOMAIN: ${APP_DOMAIN}
171 | NEXT_PUBLIC_APP_PROTOCOL: ${APP_PROTOCOL}
172 | NEXT_PUBLIC_ENV: ${APP_ENV}
173 | NODE_ENV: ${APP_ENV}
174 | NEXT_PUBLIC_TRACKING_ID: ${APP_TRACKING_ID}
175 | NEXT_PUBLIC_ALLOW_EMAIL_AUTH: ${ALLOW_EMAIL_AUTH}
176 | NEXT_PUBLIC_GOOGLE_OAUTH_CLIENT_ID: ${GOOGLE_OAUTH_CLIENT_ID}
177 | expose:
178 | - '3000'
179 | secrets: *pg-secrets
180 |
181 | nginx:
182 | <<: *service-defaults
183 | image: nginx:1.18-alpine
184 | volumes:
185 | - ./storage/errors:/etc/nginx/service-errors
186 | - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
187 | - ./nginx/nginx.conf:/etc/nginx/nginx.conf
188 | - ./storage/rfs/public:/rfs/storage
189 | environment:
190 | TZ: UTC
191 | ports:
192 | - '127.0.0.1:${APP_PORT}:80'
193 | depends_on:
194 | - api
195 | - rfs
196 | - next
197 |
--------------------------------------------------------------------------------