This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
from string import Template | |
#question = input("Enter your question: ") | |
question = "What was the first major battle in the Ukrainian War?" | |
# load the api key from a file | |
with open("config.json", "r") as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tested on Ubuntu 20.04 and 21.04 | |
sudo apt-get -y update | |
sudo apt-get -y upgrade | |
sudo apt-get -y dist-upgrade | |
# UNZIP INSTALLATION | |
sudo apt-get -y install unzip | |
# PYTHON 3 INSTALLATION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns login-app.ex) | |
(use 'ring.middleware.session | |
'ring.util.response) | |
(defn handl [{session :session uri :uri headers :headers}] | |
(let [body | |
(str | |
"<html><body>" | |
session "<br>\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat src/login_app/core.clj | |
(ns login-app.core) | |
(defn handler [request] | |
{:status 200 | |
:headers {"Content-Type" "text/html"} | |
:body "Hello World"}) | |
[ snip ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub frobnicate { | |
my( $self, $data ) = @_; | |
... | |
$self->twiddle( $data ); | |
... | |
} | |
sub twiddle { | |
my( $self, $data ) = @_; | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while ( my $data = $self->next ) { | |
my $featues = Text::FeatureCount->new->analyze($data->{content}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub frobnicate { | |
#... | |
my $dbh = MyApp->dbh; | |
#... | |
} | |
# or | |
sub frobnicate { | |
#... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $x = 'my $x = X; | |
$y = chr(39) . $x . chr(39); | |
$x =~ s/X/$y/; | |
print $x; | |
'; | |
$y = chr(39) . $x . chr(39); | |
$x =~ s/X/$y/; | |
print $x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim f As New FileObject | |
f.Open(OpenMode.Write, "TextFile.txt") | |
f.WriteLine("A line of text") | |
f.Close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim sv As StreamWriter = New StreamWriter("TextFile.txt") | |
sw.WriteLine("A line of text") | |
sw.Close() |
NewerOlder