Snippets Collections
import qrcode  
# generating a QR code using the make() function  
qr_img = qrcode.make("https://stupendous-cheesecake-5c5aa3.netlify.app")  
# saving the image file  
qr_img.save("qr-img.jpg") 
public class SpriteManager : MonoBehaviour
{
    public SpriteAtlas spriteAtlas; 

    public Image img;

    void Start()
    {
      	// public으로 선언 시, 생략하고 드래그앤드롭으로 가능
        spriteAtlas = Resources.Load<SpriteAtlas>("SpriteAtlas"); 
    }

    void Update()
    {
        if (Input.GetMouseButtonDown(0)) 
        	img.sprite = SpriteReturn("sprite0"); // 좌클릭
        if (Input.GetMouseButtonDown(1)) 
        	img.sprite = SpriteReturn("sprite1"); // 우클릭
        if (Input.GetMouseButtonDown(2)) 
        	img.sprite = SpriteReturn("sprite2"); // 휠클릭
    }

    public Sprite SpriteReturn(string spriteName)
    {
        return spriteAtlas.GetSprite(spriteName);
    }
}
 docker pull tensorflow/tensorflow:latest  # Download latest stable image
 docker run -it -p 8888:8888 tensorflow/tensorflow:latest-jupyter  # Start Jupyter server 
# Requires the latest pip
pip install --upgrade pip

# Current stable release for CPU and GPU
pip install tensorflow

# Or try the preview build (unstable)
pip install tf-nightly


NAME          RSRC
metadata.name metadata.resourceVersion
kubectl get pods <pod-name> --server-print=false
kubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>
kubectl get pods --sort-by=.metadata.name
# Create a service using the definition in example-service.yaml.

kubectl apply -f example-service.yaml



# Create a replication controller using the definition in example-controller.yaml.

kubectl apply -f example-controller.yaml



# Create the objects that are defined in any .yaml, .yml, or .json file within the <directory> directory.

kubectl apply -f <directory>
# List all pods in plain-text output format.

kubectl get pods



# List all pods in plain-text output format and include additional information (such as node name).

kubectl get pods -o wide



# List the replication controller with the specified name in plain-text output format. Tip: You can shorten and replace the 'replicationcontroller' resource type with the alias 'rc'.

kubectl get replicationcontroller <rc-name>



# List all replication controllers and services together in plain-text output format.

kubectl get rc,services



# List all daemon sets in plain-text output format.

kubectl get ds



# List all pods running on node server01

kubectl get pods --field-selector=spec.nodeName=server01
# Display the details of the node with name <node-name>.

kubectl describe nodes <node-name>



# Display the details of the pod with name <pod-name>.

kubectl describe pods/<pod-name>



# Display the details of all the pods that are managed by the replication controller named <rc-name>.

# Remember: Any pods that are created by the replication controller get prefixed with the name of the replication controller.

kubectl describe pods <rc-name>



# Describe all pods

kubectl describe pods
# Delete a pod using the type and name specified in the pod.yaml file.

kubectl delete -f pod.yaml



# Delete all the pods and services that have the label '<label-key>=<label-value>'.

kubectl delete pods,services -l <label-key>=<label-value>



# Delete all pods, including uninitialized ones.

kubectl delete pods --all
# Get output from running 'date' from pod <pod-name>. By default, output is from the first container.

kubectl exec <pod-name> -- date



# Get output from running 'date' in container <container-name> of pod <pod-name>.

kubectl exec <pod-name> -c <container-name> -- date



# Get an interactive TTY and run /bin/bash from pod <pod-name>. By default, output is from the first container.

kubectl exec -ti <pod-name> -- /bin/bash
# Return a snapshot of the logs from pod <pod-name>.

kubectl logs <pod-name>



# Start streaming the logs from pod <pod-name>. This is similar to the 'tail -f' Linux command.

kubectl logs -f <pod-name>
# Diff resources included in "pod.json".

kubectl diff -f pod.json



# Diff file read from stdin.

cat service.yaml | kubectl diff -f -
#!/bin/sh



# this plugin prints the words "hello world"

echo "hello world"
# create a simple plugin in any language and name the resulting executable file

# so that it begins with the prefix "kubectl-"

cat ./kubectl-hello
chmod a+x ./kubectl-hello



# and move it to a location in our PATH

sudo mv ./kubectl-hello /usr/local/bin

sudo chown root:root /usr/local/bin



# You have now created and "installed" a kubectl plugin.

# You can begin using this plugin by invoking it from kubectl as if it were a regular command

kubectl hello
# You can "uninstall" a plugin, by removing it from the folder in your

# $PATH where you placed it

sudo rm /usr/local/bin/kubectl-hello
The following kubectl-compatible plugins are available:

/usr/local/bin/kubectl-hello
/usr/local/bin/kubectl-foo
/usr/local/bin/kubectl-bar
sudo chmod -x /usr/local/bin/kubectl-foo # remove execute permission

kubectl plugin list
The following kubectl-compatible plugins are available:

/usr/local/bin/kubectl-hello
/usr/local/bin/kubectl-foo
  - warning: /usr/local/bin/kubectl-foo identified as a plugin, but it is not executable
/usr/local/bin/kubectl-bar

error: one plugin warning was found
#!/bin/bash



# this plugin makes use of the `kubectl config` command in order to output

# information about the current user, based on the currently selected context

kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl config current-context)'" }}Current user: {{ printf "%s\n" .context.user }}{{ end }}{{ end }}'
# make the file executable

sudo chmod +x ./kubectl-whoami



# and move it into your PATH

sudo mv ./kubectl-whoami /usr/local/bin



kubectl whoami

Current user: plugins-user
kubectl config set-context --current --namespace=<namespace-name>
kubectl get pod pod1

kubectl get pods pod1

kubectl get po pod1
import tensorflow as tf
mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(128, activation='relu'),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation='softmax')
])

model.compile(optimizer='adam',
  loss='sparse_categorical_crossentropy',
  metrics=['accuracy'])

model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)
php artisan make:controller SiteController
from pymongo import MongoClient
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from nltk.corpus import stopwords
import statistics

def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    return sentiment['compound']

def preprocess_text(text):
    # Remove stopwords
    stop_words = set(stopwords.words('english'))
    tokens = text.split()
    tokens = [token for token in tokens if token.lower() not in stop_words]
    
    return tokens




negative_comments_klm = [
    "I had a terrible experience with KLM. Their customer service was rude and unhelpful.",
    "KLM lost my luggage and didn't offer any compensation or assistance.",
    "Avoid KLM at all costs! They canceled my flight without any notice and left me stranded.",
    "I'll never fly with KLM again. Their planes are old and uncomfortable.",
    "KLM overbooked my flight and bumped me off without any compensation or apology.",
    "KLM delayed my flight multiple times and provided no explanation or updates.",
    "I had a horrible experience with KLM. They were disorganized and incompetent.",
    "KLM's customer service is the worst I've ever encountered. They were unresponsive and dismissive.",
    "KLM's website is a nightmare to use. It's slow, confusing, and full of errors.",
    "I regret choosing KLM for my trip. Their staff was rude and disrespectful.",
    "KLM's flight attendants were unprofessional and uncaring. They ignored my requests and were rude.",
    "I'll never trust KLM again. Their flight schedules are unreliable and constantly changing.",
    "KLM's prices are outrageous for the terrible service they provide. Avoid them if you can.",
    "KLM's planes are dirty and poorly maintained. I felt unsafe throughout the entire flight.",
    "I had a terrible experience with KLM's customer service. They were unhelpful and unsympathetic.",
    "KLM's food and beverage options are awful. I wouldn't feed it to my worst enemy.",
    "I'll never fly KLM again after the nightmare experience I had with them.",
    "KLM's flight attendants were rude and disrespectful. They made me feel unwelcome and uncomfortable.",
    "KLM's cancellation policy is a scam. They charged me outrageous fees to cancel my flight.",
    "I'll be filing a complaint against KLM for the horrendous service I received from them.",
    "KLM's check-in process is a disaster. It took hours to get through, and their staff was unhelpful.",
    "KLM's in-flight entertainment is outdated and limited. There was nothing to do during the flight.",
    "I had a terrible experience with KLM's booking system. It was glitchy and unreliable.",
    "KLM's seats are cramped and uncomfortable. I couldn't sleep a wink on my flight.",
    "I'll never recommend KLM to anyone after the terrible experience I had with them.",
    "KLM's flight attendants were rude and unprofessional. They treated passengers with disrespect.",
    "KLM's flight was a nightmare from start to finish. I'll never fly with them again.",
    "I had a terrible experience with KLM's baggage handling. My luggage was damaged and items were missing.",
    "KLM's customer service representatives were unhelpful and unwilling to assist me with my issue.",
    "I'll be avoiding KLM in the future. Their service was atrocious and their staff were incompetent.",
    "KLM's flight was delayed for hours without any explanation or compensation. It ruined my trip.",
    "I had a horrible experience with KLM's ground staff. They were rude and unhelpful.",
    "KLM's flight was overbooked and they refused to offer any compensation or alternative arrangements.",
    "I'll never fly with KLM again after the terrible experience I had with them.",
    "KLM's flight was cancelled at the last minute and they offered no assistance or compensation.",
    "KLM's customer service was appalling. They were unresponsive and unwilling to help me with my issue.",
    "I had a terrible experience with KLM's flight attendants. They were rude and dismissive.",
    "KLM's flight was delayed multiple times and they provided no information or updates to passengers.",
    "I'll never fly with KLM again. Their service was terrible and their staff were rude.",
    "KLM's flight was overbooked and they refused to compensate me or provide alternative arrangements.",
    "I had a horrible experience with KLM's customer service. They were unhelpful and unresponsive.",
    "KLM's website is a nightmare to navigate. It's slow, confusing, and full of errors.",
    "I'll never trust KLM again after the terrible experience I had with them.",
    "KLM's flight attendants were rude and unprofessional. They made me feel unwelcome and uncomfortable.",
    "KLM's prices are outrageous for the terrible service they provide. Avoid them if you can.",
    "KLM's planes are dirty and poorly maintained. I felt unsafe throughout the entire flight.",
    "I had a terrible experience with KLM's customer service. They were unhelpful and unsympathetic.",
    "KLM's food and beverage options are awful. I wouldn't feed it to my worst enemy.",
    "I'll never fly KLM again after the nightmare experience I had with them.",
    "KLM's flight attendants were rude and disrespectful. They made me feel unwelcome and uncomfortable.",
    "KLM's cancellation policy is a scam. They charged me outrageous fees to cancel my flight.",
    "I'll be filing a complaint against KLM for the horrendous service I received from them.",
    "KLM's check-in process is a disaster. It took hours to get through, and their staff was unhelpful.",
    "KLM's in-flight entertainment is outdated and limited. There was nothing to do during the flight.",
    "I had a terrible experience with KLM's booking system. It was glitchy and",
    "i hate klm"]
list_of_scores = []
for text in negative_comments_klm:
    preprocessed_text = preprocess_text(text)
    processed_text = ' '.join(preprocessed_text)  # Convert preprocessed tokens back to text
    score = analyze_sentiment(processed_text)
    list_of_scores.append(score)

average_score = statistics.mean(list_of_scores)
print("Average sentiment score:", average_score)
from pymongo import MongoClient
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from nltk.corpus import stopwords
import statistics

def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    return sentiment['compound']

def preprocess_text(text):
    # Remove stopwords
    stop_words = set(stopwords.words('english'))
    tokens = text.split()
    tokens = [token for token in tokens if token.lower() not in stop_words]
    
    return tokens




negative_comments_klm = [
    "I had a terrible experience with KLM. Their customer service was rude and unhelpful.",
    "KLM lost my luggage and didn't offer any compensation or assistance.",
    "Avoid KLM at all costs! They canceled my flight without any notice and left me stranded.",
    "I'll never fly with KLM again. Their planes are old and uncomfortable.",
    "KLM overbooked my flight and bumped me off without any compensation or apology.",
    "KLM delayed my flight multiple times and provided no explanation or updates.",
    "I had a horrible experience with KLM. They were disorganized and incompetent.",
    "KLM's customer service is the worst I've ever encountered. They were unresponsive and dismissive.",
    "KLM's website is a nightmare to use. It's slow, confusing, and full of errors.",
    "I regret choosing KLM for my trip. Their staff was rude and disrespectful.",
    "KLM's flight attendants were unprofessional and uncaring. They ignored my requests and were rude.",
    "I'll never trust KLM again. Their flight schedules are unreliable and constantly changing.",
    "KLM's prices are outrageous for the terrible service they provide. Avoid them if you can.",
    "KLM's planes are dirty and poorly maintained. I felt unsafe throughout the entire flight.",
    "I had a terrible experience with KLM's customer service. They were unhelpful and unsympathetic.",
    "KLM's food and beverage options are awful. I wouldn't feed it to my worst enemy.",
    "I'll never fly KLM again after the nightmare experience I had with them.",
    "KLM's flight attendants were rude and disrespectful. They made me feel unwelcome and uncomfortable.",
    "KLM's cancellation policy is a scam. They charged me outrageous fees to cancel my flight.",
    "I'll be filing a complaint against KLM for the horrendous service I received from them.",
    "KLM's check-in process is a disaster. It took hours to get through, and their staff was unhelpful.",
    "KLM's in-flight entertainment is outdated and limited. There was nothing to do during the flight.",
    "I had a terrible experience with KLM's booking system. It was glitchy and unreliable.",
    "KLM's seats are cramped and uncomfortable. I couldn't sleep a wink on my flight.",
    "I'll never recommend KLM to anyone after the terrible experience I had with them.",
    "KLM's flight attendants were rude and unprofessional. They treated passengers with disrespect.",
    "KLM's flight was a nightmare from start to finish. I'll never fly with them again.",
    "I had a terrible experience with KLM's baggage handling. My luggage was damaged and items were missing.",
    "KLM's customer service representatives were unhelpful and unwilling to assist me with my issue.",
    "I'll be avoiding KLM in the future. Their service was atrocious and their staff were incompetent.",
    "KLM's flight was delayed for hours without any explanation or compensation. It ruined my trip.",
    "I had a horrible experience with KLM's ground staff. They were rude and unhelpful.",
    "KLM's flight was overbooked and they refused to offer any compensation or alternative arrangements.",
    "I'll never fly with KLM again after the terrible experience I had with them.",
    "KLM's flight was cancelled at the last minute and they offered no assistance or compensation.",
    "KLM's customer service was appalling. They were unresponsive and unwilling to help me with my issue.",
    "I had a terrible experience with KLM's flight attendants. They were rude and dismissive.",
    "KLM's flight was delayed multiple times and they provided no information or updates to passengers.",
    "I'll never fly with KLM again. Their service was terrible and their staff were rude.",
    "KLM's flight was overbooked and they refused to compensate me or provide alternative arrangements.",
    "I had a horrible experience with KLM's customer service. They were unhelpful and unresponsive.",
    "KLM's website is a nightmare to navigate. It's slow, confusing, and full of errors.",
    "I'll never trust KLM again after the terrible experience I had with them.",
    "KLM's flight attendants were rude and unprofessional. They made me feel unwelcome and uncomfortable.",
    "KLM's prices are outrageous for the terrible service they provide. Avoid them if you can.",
    "KLM's planes are dirty and poorly maintained. I felt unsafe throughout the entire flight.",
    "I had a terrible experience with KLM's customer service. They were unhelpful and unsympathetic.",
    "KLM's food and beverage options are awful. I wouldn't feed it to my worst enemy.",
    "I'll never fly KLM again after the nightmare experience I had with them.",
    "KLM's flight attendants were rude and disrespectful. They made me feel unwelcome and uncomfortable.",
    "KLM's cancellation policy is a scam. They charged me outrageous fees to cancel my flight.",
    "I'll be filing a complaint against KLM for the horrendous service I received from them.",
    "KLM's check-in process is a disaster. It took hours to get through, and their staff was unhelpful.",
    "KLM's in-flight entertainment is outdated and limited. There was nothing to do during the flight.",
    "I had a terrible experience with KLM's booking system. It was glitchy and",
    "i hate klm"]
list_of_scores = []
for text in negative_comments_klm:
    preprocessed_text = preprocess_text(text)
    processed_text = ' '.join(preprocessed_text)  # Convert preprocessed tokens back to text
    score = analyze_sentiment(processed_text)
    list_of_scores.append(score)

average_score = statistics.mean(list_of_scores)
print("Average sentiment score:", average_score)
from pymongo import MongoClient
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import statistics


def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    return sentiment['compound']

negative_comments_klm = [
    "I had a terrible experience with KLM. Their customer service was rude and unhelpful.",
    "KLM lost my luggage and didn't offer any compensation or assistance.",
    "Avoid KLM at all costs! They canceled my flight without any notice and left me stranded.",
    "I'll never fly with KLM again. Their planes are old and uncomfortable.",
    "KLM overbooked my flight and bumped me off without any compensation or apology.",
    "KLM delayed my flight multiple times and provided no explanation or updates.",
    "I had a horrible experience with KLM. They were disorganized and incompetent.",
    "KLM's customer service is the worst I've ever encountered. They were unresponsive and dismissive.",
    "KLM's website is a nightmare to use. It's slow, confusing, and full of errors.",
    "I regret choosing KLM for my trip. Their staff was rude and disrespectful.",
    "KLM's flight attendants were unprofessional and uncaring. They ignored my requests and were rude.",
    "I'll never trust KLM again. Their flight schedules are unreliable and constantly changing.",
    "KLM's prices are outrageous for the terrible service they provide. Avoid them if you can.",
    "KLM's planes are dirty and poorly maintained. I felt unsafe throughout the entire flight.",
    "I had a terrible experience with KLM's customer service. They were unhelpful and unsympathetic.",
    "KLM's food and beverage options are awful. I wouldn't feed it to my worst enemy.",
    "I'll never fly KLM again after the nightmare experience I had with them.",
    "KLM's flight attendants were rude and disrespectful. They made me feel unwelcome and uncomfortable.",
    "KLM's cancellation policy is a scam. They charged me outrageous fees to cancel my flight.",
    "I'll be filing a complaint against KLM for the horrendous service I received from them.",
    "KLM's check-in process is a disaster. It took hours to get through, and their staff was unhelpful.",
    "KLM's in-flight entertainment is outdated and limited. There was nothing to do during the flight.",
    "I had a terrible experience with KLM's booking system. It was glitchy and unreliable.",
    "KLM's seats are cramped and uncomfortable. I couldn't sleep a wink on my flight.",
    "I'll never recommend KLM to anyone after the terrible experience I had with them.",
    "KLM's flight attendants were rude and unprofessional. They treated passengers with disrespect.",
    "KLM's flight was a nightmare from start to finish. I'll never fly with them again.",
    "I had a terrible experience with KLM's baggage handling. My luggage was damaged and items were missing.",
    "KLM's customer service representatives were unhelpful and unwilling to assist me with my issue.",
    "I'll be avoiding KLM in the future. Their service was atrocious and their staff were incompetent.",
    "KLM's flight was delayed for hours without any explanation or compensation. It ruined my trip.",
    "I had a horrible experience with KLM's ground staff. They were rude and unhelpful.",
    "KLM's flight was overbooked and they refused to offer any compensation or alternative arrangements.",
    "I'll never fly with KLM again after the terrible experience I had with them.",
    "KLM's flight was cancelled at the last minute and they offered no assistance or compensation.",
    "KLM's customer service was appalling. They were unresponsive and unwilling to help me with my issue.",
    "I had a terrible experience with KLM's flight attendants. They were rude and dismissive.",
    "KLM's flight was delayed multiple times and they provided no information or updates to passengers.",
    "I'll never fly with KLM again. Their service was terrible and their staff were rude.",
    "KLM's flight was overbooked and they refused to compensate me or provide alternative arrangements.",
    "I had a horrible experience with KLM's customer service. They were unhelpful and unresponsive.",
    "KLM's website is a nightmare to navigate. It's slow, confusing, and full of errors.",
    "I'll never trust KLM again after the terrible experience I had with them.",
    "KLM's flight attendants were rude and unprofessional. They made me feel unwelcome and uncomfortable.",
    "KLM's prices are outrageous for the terrible service they provide. Avoid them if you can.",
    "KLM's planes are dirty and poorly maintained. I felt unsafe throughout the entire flight.",
    "I had a terrible experience with KLM's customer service. They were unhelpful and unsympathetic.",
    "KLM's food and beverage options are awful. I wouldn't feed it to my worst enemy.",
    "I'll never fly KLM again after the nightmare experience I had with them.",
    "KLM's flight attendants were rude and disrespectful. They made me feel unwelcome and uncomfortable.",
    "KLM's cancellation policy is a scam. They charged me outrageous fees to cancel my flight.",
    "I'll be filing a complaint against KLM for the horrendous service I received from them.",
    "KLM's check-in process is a disaster. It took hours to get through, and their staff was unhelpful.",
    "KLM's in-flight entertainment is outdated and limited. There was nothing to do during the flight.",
    "I had a terrible experience with KLM's booking system. It was glitchy and",
    "i hate klm"]
list_of_scores = []
for text in negative_comments_klm:
    score = analyze_sentiment(text)
    list_of_scores.append(score)
aveage_score = statistics.mean(list_of_scores)
print(aveage_score)
from pymongo import MongoClient, errors
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import nltk
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
import string

# MongoDB connection settings
mongo_uri = "mongodb://localhost:27017/"
database_name = "twitter_database"
source_collection_name = "tweets"

# Initialize NLTK resources
nltk.download('punkt')
nltk.download('stopwords')
nltk.download('wordnet')

def get_text_from_doc(doc):
    """
    Extracts the text from the document.
    Returns the text if available, otherwise returns None.
    """
    text = doc.get("json_data", {}).get("text")
    if text:
        return text
    extended_text = doc.get("json_data", {}).get("extended_tweet", {}).get("full_text")
    return extended_text

def preprocess_text(text):
  
    # Remove punctuation
    tokens = [token for token in tokens if token not in string.punctuation]
    
    # Remove stopwords
    stop_words = set(stopwords.words('english') + stopwords.words('spanish') + stopwords.words('dutch'))    
    tokens = [token for token in tokens if token not in stop_words]
    
    # Lemmatization
    lemmatizer = WordNetLemmatizer()
    tokens = [lemmatizer.lemmatize(token) for token in tokens]
    
    return tokens

def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    return sentiment['compound']

try:
    client = MongoClient(mongo_uri, serverSelectionTimeoutMS=5000)
    db = client[database_name]
    source_collection = db[source_collection_name]

    cursor = source_collection.find().limit(20)  # Limit to only 20 tweets

    for doc in cursor:
        text = get_text_from_doc(doc)
        if text:
            preprocessed_text = preprocess_text(text)
            processed_text = ' '.join(preprocessed_text)  # Convert preprocessed tokens back to text
            print("Original Text:", text)
            print("Processed Text:", processed_text)
            print("Sentiment Score:", analyze_sentiment(processed_text))
            print()

except errors.ServerSelectionTimeoutError as err:
    print("Failed to connect to MongoDB server:", err)
except errors.PyMongoError as err:
    print("An error occurred while working with MongoDB:", err)
finally:
    client.close()
from pymongo import MongoClient
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import statistics
def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    return sentiment['compound']
neutral_comments_klm = [
    "I have a flight booked with KLM.",
    "I'm flying with KLM next month.",
    "I've used KLM for my travels before.",
    "I'm considering KLM for my upcoming trip.",
    "KLM operates flights to various destinations.",
    "I'll be flying with KLM for my vacation.",
    "KLM offers flights at competitive prices.",
    "I'll be traveling with KLM for work.",
    "I've heard about KLM's services.",
    "KLM is one of the airlines I'm considering.",
    "I've seen advertisements for KLM.",
    "I'll be using KLM for my international flight.",
    "KLM provides options for connecting flights.",
    "I need to check KLM's flight schedule.",
    "I'm looking into KLM's frequent flyer program.",
    "I received an email from KLM.",
    "I'm exploring flight options with KLM.",
    "KLM offers flights with various amenities.",
    "I'll be flying with KLM for my family visit.",
    "KLM has partnerships with other airlines.",
    "I'll be using KLM for my business trip.",
    "KLM has a website for booking flights.",
    "I'll be flying with KLM because of the route.",
    "KLM provides options for different classes.",
    "I've considered KLM for my travel plans.",
    "KLM offers online check-in.",
    "I've received information about KLM's services.",
    "I'll be flying with KLM due to convenience.",
    "KLM has a mobile app for flight management.",
    "I'll be using KLM for my upcoming trip abroad.",
    "KLM offers options for booking accommodations.",
    "I've heard about KLM's customer service.",
    "I'll be considering KLM for future travels.",
    "KLM provides options for flight upgrades.",
    "I'll be flying with KLM because of recommendations.",
    "KLM offers options for flight insurance.",
    "I've checked KLM's flight status online.",
    "I'll be flying with KLM for personal reasons.",
    "KLM provides options for seat selection.",
    "I've received promotions from KLM.",
    "I'll be flying with KLM for leisure travel.",
    "KLM offers options for in-flight entertainment.",
    "I've read about KLM's safety measures.",
    "I'll be flying with KLM because of scheduling.",
    "KLM provides options for booking car rentals.",
    "I've looked into KLM's baggage policies.",
    "I'll be flying with KLM for holiday travel.",
    "KLM offers options for travel insurance.",
    "I've explored KLM's route map.",
    "I'll be considering KLM for my next trip.",
    "KLM provides options for airport transfers.",
    "I've browsed KLM's website for information.",
    "I'll be flying with KLM due to flexibility.",
    "KLM offers options for flight add-ons.",
    "I've researched KLM's onboard services.",
    "I'll be considering KLM for my future travels.",
    "KLM provides options for special assistance.",
    "I've looked into KLM's loyalty program.",
    "I'll be flying with KLM for my international trip.",
    "KLM offers options for travel packages.",
    "I've compared KLM's fares with other airlines.",
    "I'll be considering KLM for my next vacation.",
    "KLM provides options for dietary preferences.",
    "I've checked KLM's reviews online.",
    "I'll be flying with KLM for my trip to Europe.",
    "KLM offers options for travel upgrades.",
    "I've explored KLM's flight routes.",
    "I'll be considering KLM for my next adventure.",
    "KLM provides options for group bookings."
]


list_of_scores = []
for text in neutral_comments_klm:
    score = analyze_sentiment(text)
    list_of_scores.append(score)
aveage_score = statistics.mean(list_of_scores)
print(aveage_score)


from pymongo import MongoClient, errors
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer

# MongoDB connection settings
mongo_uri = "mongodb://localhost:27017/"
database_name = "twitter_database"
source_collection_name = "tweets"

def get_text_from_doc(doc):
    """
    Extracts the text from the document.
    Returns the text if available, otherwise returns None.
    """
    text = doc.get("json_data", {}).get("text")
    if text:
        return text
    extended_text = doc.get("json_data", {}).get("extended_tweet", {}).get("full_text")
    return extended_text

def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    compound_score = sentiment['compound']
    if compound_score > 0.05:
        return 'positive'
    elif compound_score < -0.05:
        return 'negative'
    else:
        return 'neutral'

try:
    client = MongoClient(mongo_uri, serverSelectionTimeoutMS=5000)
    db = client[database_name]
    source_collection = db[source_collection_name]

    # Define query to filter tweets related to KLM (tweets made by KLM or mentioning KLM)
    query = {
        "$or": [
            {"json_data.user.id": 56377143},  # Tweets made by KLM
            {"json_data.entities.user_mentions.id": 56377143}  # Tweets mentioning KLM
        ]
    }

    # Count variables for sentiment analysis
    positive_count = 0
    neutral_count = 0
    negative_count = 0

    cursor = source_collection.find(query)

    for doc in cursor:
        text = get_text_from_doc(doc)
        if text:
            sentiment = analyze_sentiment(text)
            if sentiment == 'positive':
                positive_count += 1
            elif sentiment == 'neutral':
                neutral_count += 1
            elif sentiment == 'negative':
                negative_count += 1

    print("Number of tweets related to KLM:")
    print("Positive:", positive_count)
    print("Neutral:", neutral_count)
    print("Negative:", negative_count)

except errors.ServerSelectionTimeoutError as err:
    print("Failed to connect to MongoDB server:", err)
except errors.PyMongoError as err:
    print("An error occurred while working with MongoDB:", err)
finally:
    client.close()
import random

# Define the fruit and number words
fruits = ['pear']
number_words = ['forty-one']

# Function to generate a random fruit and number word
def get_random_fruit_and_number():
    fruit = random.choice(fruits)
    number_word = random.choice(number_words)
    return fruit, number_word

# Function to display the game
def play_game():
    print("Welcome to the Number Words Fruit Splat Game!")
    print("Match the number word to the correct number of fruits.")
    
    score = 0
    while True:
        fruit, number_word = get_random_fruit_and_number()
        print(f"How many {fruit}s are there?")
        user_input = input("Enter the number word: ")
        
        if user_input.lower() == number_word:
            print("Correct!")
            score += 1
        else:
            print(f"Incorrect. The correct answer is {number_word}.")
        
        print(f"Your current score is: {score}")
        
        play_again = input("Do you want to play again? (y/n) ")
        if play_again.lower() != 'y':
            break

if __name__ == "__main__":
    play_game()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

	
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        'Chargement de l'image
        Me.PictureBox1.Image = System.Drawing.Bitmap.FromFile("C:\Documents and Settings\Ludo\Bureau\Video Club\Jacquettes\hardcandy.jpg")
 
 
        'Définit un objet Graphics avec l'image de ton picturebox
        Dim ObjGraphics As Graphics = Graphics.FromImage(Me.PictureBox1.Image)
 
        'Définit le pinceau pour l'écriture 
        Dim brush As Brush = New SolidBrush(Color.Black)
 
 
        'Définit la police d'écriture avec la taille ainsi que le style (gras, italique...)
        Dim font As New Font("times new roman", 20, FontStyle.Bold)
 
        'Dessine le texte sur l'image à la position X de 10 et Y de 10
        ObjGraphics.DrawString(Me.TextBox1.Text, font, Brushes.Brown, 10, 10)
 
        'Libère les ressources
        ObjGraphics.Dispose()
 
        'Redessine l'image avec le texte
        Me.PictureBox1.Image = Me.PictureBox1.Image
 
    End Sub
flyway -configFiles=configs/flyway_staging.conf migrate  


add migrations location
flyway.locations=filesystem:/Users/pullamma/go/src/github.com/Zomato/logistics-bonus-service/deployment/migrations
Program 1: This program creates a shared memory segment, attaches itself to it and then writes some content into the shared memory segment.
Solution:
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/shm.h>
#include<string.h>
int main()
{
int i;
void *shared_memory;
char buff[100];
int shmid;
shmid=shmget((key_t)2345, 1024, 0666|IPC_CREAT); 
printf("Key of shared memory is %d\n",shmid);
shared_memory=shmat(shmid,NULL,0); //process attached to shared memory segment
printf("Process attached at %p\n",shared_memory); //this prints the address where the segment is attached with this process
printf("Enter some data to write to shared memory\n");
read(0,buff,100); //get some input from user
strcpy(shared_memory,buff); //data written to shared memory
printf("You wrote : %s\n",(char *)shared_memory);
}

//Program 2: This program attaches itself to the shared memory segment created in Program 1. Finally, it reads the content of the shared memory.
Solution:
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/shm.h>
#include<string.h>
int main()
{
int i;
void *shared_memory;
char buff[100];
int shmid;
shmid=shmget((key_t)2345, 1024, 0666);
printf("Key of shared memory is %d\n",shmid);
shared_memory=shmat(shmid,NULL,0); //process attached to shared memory segment
printf("Process attached at %p\n",shared_memory);
printf("Data read from shared memory is : %s\n",(char *)shared_memory);
}
; array_sort.asm
.model small
.stack 100h
.data
    array db 5, 3, 8, 4, 2 ; Array to be sorted
    array_size equ $-array ; Size of the array
    newline db 0Dh, 0Ah, '$' ; Newline characters for printing
    space db ' $' ; Space character for printing

.code
main proc
    mov ax, @data
    mov ds, ax
    mov es, ax

    ; Initialize pointers
    lea si, array
    mov cx, array_size

outer_loop:
    dec cx
    jz sorted ; If the size is 0, array is sorted

    mov di, si
    mov bx, cx

inner_loop:
    mov al, [di]
    mov ah, [di+1]
    cmp al, ah
    jbe no_swap

    ; Swap elements
    xchg al, ah
    mov [di], al
    mov [di+1], ah

no_swap:
    inc di
    dec bx
    jnz inner_loop

    jmp outer_loop

sorted:
    ; Print sorted array
    lea si, array
    mov cx, array_size

print_loop:
    mov al, [si]
    add al, '0' ; Convert to ASCII
    mov dl, al
    mov ah, 02h
    int 21h

    ; Print space
    lea dx, space
    mov ah, 09h
    int 21h

    inc si
    loop print_loop

    ; Print newline
    lea dx, newline
    mov ah, 09h
    int 21h

    ; Terminate program
    mov ah, 4Ch
    int 21h

main endp
end main
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bill</title>
</head>
<body>
    <h1>Bill</h1>

    <div id="customerDetails">
        <!-- Customer details will be displayed here -->
    </div>

    <div id="selectedItems">
        <!-- Selected items will be displayed here -->
    </div>

    <script>
        document.addEventListener("DOMContentLoaded", function() {
            // Retrieve customer details from localStorage
            var customerData = JSON.parse(localStorage.getItem('customerData'));

            // Display customer details if available
            if (customerData) {
                var customerDetailsHTML = '<h2>Customer Details</h2>' +
                    '<p>Name: ' + customerData.customerName + '</p>' +
                    '<p>Mobile: ' + customerData.customerMobile + '</p>' +
                    '<p>Table: ' + customerData.customerTable + '</p>';
                document.getElementById('customerDetails').innerHTML = customerDetailsHTML;
            } else {
                // Handle case where customer details are not available
                console.log("Customer details not found.");
            }

            // Retrieve and display selected items for each category
            var selectedItemsHTML = '<h2>Selected Items</h2>';
            // Add code here to retrieve and display selected items for each category

            document.getElementById('selectedItems').innerHTML = selectedItemsHTML;
        });

        function confirmOrder(category) {
            // Get the selected items from the respective popup
            var selectedItems = [];
            var itemList = document.querySelectorAll('.' + category + '-popup-container input[type="number"]');
            itemList.forEach(function(item) {
                var itemName = item.parentElement.querySelector('span').textContent;
                var itemQuantity = item.value;
                if (itemQuantity > 0) {
                    selectedItems.push({ name: itemName, quantity: itemQuantity });
                }
            });

            // Get customer details
            var customerName = document.getElementById('name').value;
            var customerMobile = document.getElementById('mobile').value;
            var customerTable = document.getElementById('table').value;

            // Combine customer details with selected items
            var orderData = {
                customerName: customerName,
                customerMobile: customerMobile,
                customerTable: customerTable,
                selectedItems: selectedItems
            };

            // Store the combined data in localStorage
            localStorage.setItem('customerData', JSON.stringify(orderData)); // Store customer details

            // Optionally, you can also display a confirmation message
            alert('Order confirmed for ' + category + '. Thank you!');
        }

        function redirectToBill() {
            window.location.href = "bill.html";
        }
    </script>
</body>
</html>
	accountCode = 202;
	searchMap = Map();
	searchMap.put("account_code",accountCode);
	///
	fetch = zoho.books.getRecords("chartofaccounts","20091181966",searchMap,"zoho_books");
	info fetch;
star

Sat Jun 01 2024 04:02:04 GMT+0000 (Coordinated Universal Time)

@dsce

star

Sat Jun 01 2024 02:35:35 GMT+0000 (Coordinated Universal Time) https://maintaining.tistory.com/entry/Unity-스프라이트-아틀라스Sprite-Atlas-사용-방법

@khyinto #c#

star

Sat Jun 01 2024 00:46:56 GMT+0000 (Coordinated Universal Time) https://ai.google.dev/gemini-api/docs/ai-studio-quickstart?_gl

@calazar23

star

Sat Jun 01 2024 00:46:54 GMT+0000 (Coordinated Universal Time) https://ai.google.dev/gemini-api/docs/ai-studio-quickstart?_gl

@calazar23

star

Sat Jun 01 2024 00:38:08 GMT+0000 (Coordinated Universal Time) https://github.com/Saalam121/ADSJ.git

@signup

star

Fri May 31 2024 22:39:38 GMT+0000 (Coordinated Universal Time) https://www.tensorflow.org/install

@calazar23 #bsh

star

Fri May 31 2024 22:39:35 GMT+0000 (Coordinated Universal Time) https://www.tensorflow.org/install

@calazar23 #bsh

star

Fri May 31 2024 22:25:14 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:25:12 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:25:07 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:25:04 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:25:02 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:25:00 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:55 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:52 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:49 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:45 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:43 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:40 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:37 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:34 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:24 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:19 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:10 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:05 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:03 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:24:00 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:23:48 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:23:32 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:23:29 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:23:27 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:22:44 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:22:31 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:22:22 GMT+0000 (Coordinated Universal Time) https://kubernetes.io/docs/reference/kubectl/

@calazar23

star

Fri May 31 2024 22:13:17 GMT+0000 (Coordinated Universal Time) https://www.tensorflow.org/

@calazar23

star

Fri May 31 2024 21:21:17 GMT+0000 (Coordinated Universal Time)

@jdeveloper #php

star

Fri May 31 2024 20:20:54 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Fri May 31 2024 18:51:38 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Fri May 31 2024 18:37:36 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Fri May 31 2024 18:16:47 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Fri May 31 2024 16:51:22 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Fri May 31 2024 16:21:44 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Fri May 31 2024 16:02:35 GMT+0000 (Coordinated Universal Time) https://www.sheppardsoftware.com/math/early-math/number-words-fruit-splat-game/

@s727769

star

Fri May 31 2024 15:45:29 GMT+0000 (Coordinated Universal Time) https://www.developpez.net/forums/d320845/dotnet/developpement-windows/windows-forms/mettre-texte-picturebox/

@demelevet

star

Fri May 31 2024 15:20:10 GMT+0000 (Coordinated Universal Time) https://prizewall.xyz/

@llvllike

star

Fri May 31 2024 15:07:48 GMT+0000 (Coordinated Universal Time)

@pullamma

star

Fri May 31 2024 14:56:20 GMT+0000 (Coordinated Universal Time)

@signup

star

Fri May 31 2024 14:53:25 GMT+0000 (Coordinated Universal Time)

@signup

star

Fri May 31 2024 14:07:20 GMT+0000 (Coordinated Universal Time)

@dsce

star

Fri May 31 2024 12:08:03 GMT+0000 (Coordinated Universal Time)

@RehmatAli2024 #deluge

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension