Skip to content

Commit 7fd4649

Browse files
Upload
1 parent 7b4e48b commit 7fd4649

File tree

3 files changed

+385
-0
lines changed

3 files changed

+385
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { defineCodeRunnersSetup } from '@slidev/types'
2+
import { CodeRunnerOutputs } from '@slidev/types'
3+
4+
export default defineCodeRunnersSetup(() => {
5+
return {
6+
async python(code) {
7+
const results = await godboltPythonRequest(code);
8+
return results;
9+
}
10+
}
11+
})
12+
13+
async function godboltPythonRequest(code: string): Promise<CodeRunnerOutputs> {
14+
try {
15+
// Godbolt API URL for Python 3.12
16+
const apiUrl = 'https://godbolt.org/api/compiler/python312/compile';
17+
18+
// Make an asynchronous POST request to the Godbolt API with the Python code
19+
const response = await fetch(apiUrl, {
20+
method: 'POST',
21+
headers: {
22+
'Content-Type': 'application/json',
23+
'Accept': 'application/json' // We need to explicitly ask for a JSON response, text is the default
24+
},
25+
body: JSON.stringify({
26+
source: code,
27+
options: {
28+
compilerOptions: {"executorRequest": true}, // We want to compile + execute
29+
executeParameters: {},
30+
}
31+
})
32+
});
33+
34+
// Check if the response is successful
35+
if (!response.ok) {
36+
return {
37+
error: `Bad response: ${response.statusText}`
38+
};
39+
}
40+
41+
// Parse the response as JSON
42+
const result = await response.json();
43+
44+
// Extract stdout lines and convert them into CodeRunnerOutputText objects
45+
const stdout = result.stdout.map((line: any) => ({
46+
text: line.text
47+
// Hack to keep leading whitespace
48+
.replace(/\s/g, "‎ ")
49+
.replace(/\t/g, "‎ ")
50+
}
51+
));
52+
53+
// Extract stderr lines and convert them into CodeRunnerOutputText objects
54+
const stderr = result.stderr.map((line: any) => ({
55+
text: line.text
56+
// Hack to keep leading whitespace
57+
.replace(/\s/g, "‎ ")
58+
.replace(/\t/g, "‎ "),
59+
class: 'text-red-500'
60+
}
61+
));
62+
63+
if (stderr.length !== 0) {
64+
return stderr;
65+
} else if (stdout.length !== 0) {
66+
return stdout;
67+
} else {
68+
return {
69+
text: 'No output received'
70+
};
71+
}
72+
} catch (error) {
73+
console.error('Failed to execute Python code:', error);
74+
return {
75+
error: `Failed to execute Python code: ${error.message}`
76+
};
77+
}
78+
}
79+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
---
2+
layout: intro
3+
theme: neversink
4+
color: bowdoin
5+
routerMode: hash
6+
favicon: https://avatars.githubusercontent.com/u/9260792
7+
---
8+
9+
## Introduction to Intellectual Property <twemoji-light-bulb />
10+
#### Module 2: Intellectual Property
11+
12+
<br>
13+
14+
<hr><br>
15+
16+
Christopher Martin - _Bowdoin College_ <a href="https://bowdoin.edu/" class="ns-c-iconlink"><mdi-open-in-new /></a>
17+
<Email v="[email protected]" />
18+
19+
---
20+
layout: section
21+
color: bowdoin
22+
---
23+
24+
## What does it mean to *"own"* something?
25+
26+
<br>
27+
28+
### What rights do we have over the ==property== we own?
29+
30+
<twemoji-thinking-face v-drag="[836,374,96,89]" />
31+
32+
---
33+
layout: top-title
34+
color: bowdoin-title
35+
---
36+
37+
:: title ::
38+
39+
# Property Rights
40+
41+
:: content ::
42+
43+
# What rights does an owner have over a good?
44+
45+
### - The right to <u>use</u> the good
46+
47+
<br>
48+
49+
### - The right to <u>earn income</u> from the good
50+
51+
<br>
52+
53+
### - The right to <u>transfer ownership</u> of the good
54+
55+
<br>
56+
57+
### - The right to <u>abandon</u> the good
58+
59+
<br>
60+
61+
### - The right to <u>alter</u> or even <u>destroy</u> the good
62+
63+
<br>
64+
<br>
65+
66+
## These makes sense for physical goods but what about intangible things like ideas, do we "own" those? Do we have the same rights?
67+
68+
<twemoji-thinking-face v-drag="[771,214,96,89]" />
69+
70+
---
71+
layout: top-title
72+
color: bowdoin-title
73+
---
74+
75+
:: title ::
76+
77+
# Intellectual Property
78+
79+
:: content ::
80+
81+
# ==Intellectual Property==, commonly referred to as just "IP", is a category of property that includes nontangible creations
82+
83+
<br>
84+
85+
### Treating IP in the same way as physical property recognizes the value of intelligent and artistic works which come from creativity, ideas, research, skills, labor, non-material efforts.
86+
87+
<br>
88+
89+
### Giving people and businesses property rights to the information and intellectual goods they create also provides economic incentive as well as stimulates creation/invention!
90+
91+
<br>
92+
93+
# ==What are some potential downsides of allowing the ownership of intangible things?==
94+
95+
---
96+
layout: top-title
97+
color: bowdoin-title
98+
---
99+
100+
:: title ::
101+
102+
# Examples of IP
103+
104+
:: content ::
105+
106+
# Some examples of IP are:
107+
## - Inventions
108+
## - Databases / datasets
109+
## - Works of authorship
110+
## - Trademarks / Service marks
111+
## - Logos
112+
## - Designs
113+
## - Business or trade names
114+
## - Commercial secrets
115+
## - Computer software
116+
117+
<br>
118+
119+
### ==Why is it important that these things be protected and have ownership exerted over them?==
120+
121+
<twemoji-light-bulb v-drag="[660,278,96,89]" />
122+
<twemoji-thinking-face v-drag="[767,279,96,89]" />
123+
124+
---
125+
layout: top-title
126+
color: bowdoin-title
127+
---
128+
129+
:: title ::
130+
131+
# Intellectual vs Physical property
132+
133+
:: content ::
134+
135+
<br>
136+
137+
# Physical property typically only has one “owner” at a time.
138+
139+
<br>
140+
141+
# Intellectual property can be copied and simultaneously owned by multiple people.
142+
143+
<br>
144+
145+
# Someone can reposes physical property that is stolen, but we cannot simply "take back" an idea..
146+
147+
<br>
148+
<br>
149+
150+
# ==What are other ways IP is different from physical property?==
151+
152+
---
153+
layout: side-title
154+
titlewidth: is-2
155+
align: cm-lm
156+
color: bowdoin-title
157+
---
158+
159+
:: title ::
160+
161+
# Pros and Cons
162+
163+
:: content ::
164+
165+
# ==Is it harmful to keep the "usage" or "availability" of IP limited?==
166+
167+
<br>
168+
169+
### Society benefits when ideas are shared
170+
171+
<br>
172+
173+
### Prices fall when works enter the ==public domain== and when competition is available.
174+
175+
<br>
176+
<br>
177+
178+
# ==Is there a one-size-fits-all ruling that can be made for how IP can be owned or used or do you think it varies?==
179+
180+
---
181+
layout: top-title
182+
color: bowdoin-title
183+
---
184+
185+
:: title ::
186+
187+
# Who owns an idea?
188+
189+
:: content ::
190+
191+
192+
### The almost universal rule in the United States and other industrialized countries is that an employer owns the rights to ideas and inventions of employees — when the idea or invention was created by the employee on-the-job or when using the employer’s facilities, equipment, and/or data.
193+
194+
<br>
195+
196+
### As a result of this, Bowdoin College could potentially claim ownership over IP I create while teaching here!
197+
198+
<br>
199+
200+
### Similarly, Bowdoin College could also claim ownership over some of the IP you create while being a student here!
201+
202+
<br>
203+
204+
## You really need to check on a per-institution / employer basis!
205+
206+
<twemoji-astonished-face v-drag="[865,411,96,89]" />
207+
208+
---
209+
layout: iframe
210+
url: https://www.bowdoin.edu/academic-affairs/pdf/2024-2025facultyhandbook.pdf
211+
---
212+
213+
---
214+
layout: section
215+
color: bowdoin
216+
---
217+
218+
### ==Did you know that Bowdoin could potentially claim ownership over your IP?==
219+
220+
<br>
221+
<br>
222+
223+
### ==How do you feel about employers owning the ideas and inventions of employees?==
224+
225+
---
226+
layout: top-title
227+
color: bowdoin-title
228+
---
229+
230+
:: title ::
231+
232+
# How does this relate to engineering?
233+
234+
:: content ::
235+
236+
#### As we talked about before, illegal copying is pervasive due to he Internet allows copies to spread quickly and widely!
237+
238+
<br>
239+
240+
#### Global availability! (Think about international laws).
241+
242+
<br>
243+
244+
#### Digital goods are incredibly easy to copy and distribute.
245+
246+
<br>
247+
248+
#### With scanning and compression technology, creating perfect copies of large physical materials is possible.
249+
250+
<br>
251+
252+
#### Search engines make finding material easier!
253+
254+
<br>
255+
256+
#### Peer-to-peer technology makes sharing files without oversight possible!
257+
258+
<br>
259+
260+
#### ==AI can generate content, who owns the rights then? How to we prevent or detect?==
261+
262+
---
263+
layout: section
264+
color: bowdoin
265+
---
266+
267+
### ==What do you personally feel about the difficulty of protecting intellectual property as a possible inventor?==
268+
269+
<twemoji-astonished-face v-drag="[865,411,96,89]" />
270+
271+
---
272+
layout: section
273+
color: bowdoin
274+
---
275+
276+
# Questions?
277+
278+
<twemoji-thinking-face v-drag="[813,227,96,89]" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { defineConfig } from 'unocss'
2+
import { colors } from '@unocss/preset-mini'
3+
4+
export default defineConfig ({
5+
rules: [
6+
['neversink-bowdoin-scheme', {
7+
'--neversink-bg-color': colors['white'],
8+
'--neversink-bg-code-color': colors['gray'][100],
9+
'--neversink-fg-code-color': colors['black'],
10+
'--neversink-fg-color': colors['black'],
11+
'--neversink-text-color': colors['black'],
12+
'--neversink-border-color': colors['gray'][950],
13+
'--neversink-highlight-color': colors['gray'][300],
14+
}],
15+
['neversink-bowdoin-title-scheme', {
16+
'--neversink-bg-color': colors['black'],
17+
'--neversink-bg-code-color': colors['gray'][100],
18+
'--neversink-fg-code-color': colors['black'],
19+
'--neversink-fg-color': colors['black'],
20+
'--neversink-text-color': colors['white'],
21+
'--neversink-border-color': colors['gray'][950],
22+
'--neversink-highlight-color': colors['gray'][300],
23+
}]
24+
],
25+
safelist: [
26+
'neversink-bowdoin-scheme', 'neversink-bowdoin-title-scheme'
27+
]
28+
})

0 commit comments

Comments
 (0)