Skip to content

Instantly share code, notes, and snippets.

@ericksoa
ericksoa / tweepy-api-call.py
Last active March 15, 2023 03:15
Authenticate with the Twitter API
import tweepy
# Replace these values with your own credentials
API_KEY = 'your_api_key'
API_SECRET_KEY = 'your_api_secret_key'
ACCESS_TOKEN = 'your_access_token'
ACCESS_TOKEN_SECRET = 'your_access_token_secret'
auth = tweepy.OAuthHandler(API_KEY, API_SECRET_KEY)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
pip install tweepy
@ericksoa
ericksoa / make-random-compliment
Created March 15, 2023 03:19
Make a random compliment using the twitter API
import random
def get_random_compliment():
compliments = [
"You are amazing!",
"You're a true inspiration!",
"Keep up the great work!",
"You have a heart of gold!",
"Your creativity knows no bounds!",
]
@ericksoa
ericksoa / like-and-rewteet
Created March 15, 2023 03:23
Program that uses the twitter API to increase engagement
import random
import time
def get_random_compliment():
compliments = [
"You are amazing!",
"You're a true inspiration!",
"Keep up the great work!",
"You have a heart of gold!",
"Your creativity knows no bounds!",
@ericksoa
ericksoa / dont-be-evil.py
Created March 15, 2023 03:26
Allow a bot to do parameterized emotional manipulation
import random
import time
def get_message(emotion):
messages = {
"happy": [
"Stay positive and keep smiling!",
"Happiness is contagious, spread it around!",
"Embrace the good vibes today!",
"Share your joy with the world!",
@ericksoa
ericksoa / manifest.json
Created March 20, 2023 01:35
Twitter Regex Blocker Chrome Plugin - manifest.json
{
"manifest_version": 2,
"name": "Twitter Regex Filter",
"version": "1.0",
"description": "Hides tweets containing text that matches a given regex pattern.",
"permissions": ["https://twitter.com/*"],
"content_scripts": [
{
"matches": ["https://twitter.com/*"],
"js": ["content.js"],
@ericksoa
ericksoa / content.js
Created March 20, 2023 01:40
Chrome Plug In Block By Regex - content.js
const regexPattern = /your-regex-pattern/;
function hideTweet(tweet) {
tweet.style.display = 'none';
}
function processTweets() {
const tweets = document.querySelectorAll('[data-testid="tweet"]');
for (const tweet of tweets) {
const tweetText = tweet.textContent;
@ericksoa
ericksoa / styles.css
Created March 20, 2023 01:42
Chrome Twitter Refex Blocker - styles.css
/* Add any custom styles here */
@ericksoa
ericksoa / weeklyReport.ts
Created March 21, 2023 18:56
Summarize your work from Jira into an engaging narrative for your boss
// Step 1: Setup your development environment and install required dependencies.
// Install required packages using npm or yarn:
// npm install axios @types/axios dotenv openai @types/node
// or
// yarn add axios @types/axios dotenv openai @types/node
import axios, { AxiosResponse } from 'axios';
import * as dotenv from 'dotenv';
import * as openai from 'openai';
@ericksoa
ericksoa / panopticon.ts
Created March 21, 2023 19:08
Gather calendar events and commit stats for use in your upcoming 1:1 meeting
import { exec } from "child_process";
import { google } from "googleapis";
import { Credentials } from "google-auth-library";
import axios from "axios";
const OPENAI_API_KEY = "<your_openai_api_key>";
const GIT_REPO_PATH = "<your_git_repo_path>";
const GOOGLE_CREDENTIALS = <your_google_credentials> as Credentials;
async function getCommitStats(email: string, fromDate: string, toDate: string): Promise<string> {