Giter Club home page Giter Club logo

assignments's Introduction

assignments

a place to put my final projects to look back on and study,

just a little home for some of my assignments as a backlog.

assignments's People

Contributors

ikustudies avatar

Watchers

 avatar

assignments's Issues

Another idea

For techheadz.xyz header

<style> .header-container { position: relative; height: 200px; overflow: hidden; }
.pixel {
  position: absolute;
  display: block;
  width: 10px;
  height: 10px;
  background-color: #333;
  animation: raining 2s infinite;
}

.dancing-headline {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: bold;
  color: #333;
  animation: dancingHeadline 2s infinite;
}

@keyframes raining {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

@keyframes dancingHeadline {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  25% {
    transform: translate(-50%, -50%) rotate(-10deg);
  }
  50% {
    transform: translate(-50%, -50%) rotate(10deg);
  }
  75% {
    transform: translate(-50%, -50%) rotate(-5deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
}
</style>
<h1 class="dancing-headline">
  TechHeadz.xyz
</h1>
<script> function createPixel() { const pixel = document.createElement('div'); pixel.className = 'pixel'; pixel.style.left = Math.random() * 100 + 'vw'; document.querySelector('.header-container').appendChild(pixel); setTimeout(() => { pixel.remove(); }, 2000); // Adjust the duration (in milliseconds) to control how long the pixels stay visible } setInterval(createPixel, 200); // Adjust the interval (in milliseconds) to control the rate of falling pixels </script>

Idea for automating techheadz.xyz

Might offer advertising on the website... and have my tweets also make a blog post on techheadz

So i just have to feed it 12 papers a day.

Heres an automated template of my idea

import requests
from bs4 import BeautifulSoup
import re
import openai
import tweepy
import time

# Set up OpenAI API credentials
openai.api_key = 'YOUR_API_KEY'

# Twitter API credentials
consumer_key = 'YOUR_CONSUMER_KEY'
consumer_secret = 'YOUR_CONSUMER_SECRET'
access_token = 'YOUR_ACCESS_TOKEN'
access_token_secret = 'YOUR_ACCESS_TOKEN_SECRET'

# List of paper links
paper_links = [
    'https://example.com/paper1',
    'https://example.com/paper2',
    # Add more paper links here
]

# Function to scrape relevant content from a given paper link
def scrape_paper_content(link):
    response = requests.get(link)
    html_content = response.text
    
    soup = BeautifulSoup(html_content, 'html.parser')
    
    # Extract relevant content using appropriate selectors
    title = soup.find('h1').text.strip()
    abstract = soup.find('div', class_='abstract').text.strip()
    paper_text = soup.find('div', class_='paper-text').text.strip()
    
    # Preprocess the text
    title = re.sub('\n+', ' ', title)
    abstract = re.sub('\n+', ' ', abstract)
    paper_text = re.sub('\n+', ' ', paper_text)
    
    return title, abstract, paper_text

# Function to generate a tweet for a given paper
def generate_paper_tweet(link):
    title, abstract, paper_text = scrape_paper_content(link)
    
    # Prepare the content to send to the language model
    prompt = f"Title: {title}\n\nAbstract: {abstract}\n\nPaper: {paper_text}"
    response = openai.Completion.create(
        engine='text-davinci-003',
        prompt=prompt,
        max_tokens=279,
        temperature=0.7,
        n=1,
        stop=None
    )
    summary = response.choices[0].text.strip()
    
    # Generate relevant hashtags based on the paper's topic
    hashtags = get_paper_hashtags(title)
    
    # Generate the tweet
    tweet = f"{summary} Read more: {link} {hashtags}"
    return tweet[:279]  # Limit to 279 characters

# Function to generate relevant hashtags based on the paper's topic
def get_paper_hashtags(title):
    # Generate relevant hashtags based on the paper's topic
    # You can customize this function based on your specific requirements
    # Here's an example implementation that generates three hashtags based on the words in the paper title
    words = title.split()
    hashtags = ['#'+word.lower() for word in words if len(word) > 3][:3]
    return ' '.join(hashtags)

# Function to authenticate and post a tweet
def tweet(message):
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)
    api = tweepy.API(auth)
    api.update_status(message)

# Main loop
for link in paper_links:
    try:
        tweet_text = generate_paper_tweet(link)
        tweet(tweet_text)
        print("Tweeted:", tweet_text)
    except Exception as e:
        print("Error:", str(e))
    
    time.sleep(2 * 60 * 60)  # Sleep for 2 hours

# Stop the program after iterating through the list
print("Finished processing all paper links. Program stopped.")
``

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.