<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by headsink on Medium]]></title>
        <description><![CDATA[Stories by headsink on Medium]]></description>
        <link>https://medium.com/@headsink?source=rss-f7db622cc5a6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0MXuYtsyBMA_05O50elrBA.jpeg</url>
            <title>Stories by headsink on Medium</title>
            <link>https://medium.com/@headsink?source=rss-f7db622cc5a6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 22:21:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@headsink/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I ask Open Assistant: How do I make you analyze my Twitter archive which had 13 years worth of data…]]></title>
            <link>https://medium.com/@headsink/i-ask-open-assistant-how-do-i-make-you-analyze-my-twitter-archive-which-had-13-years-worth-of-data-e0b88844d1d4?source=rss-f7db622cc5a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0b88844d1d4</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[twitter-archive]]></category>
            <category><![CDATA[open-assistant]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[headsink]]></dc:creator>
            <pubDate>Mon, 17 Apr 2023 23:58:57 GMT</pubDate>
            <atom:updated>2023-04-17T23:58:57.738Z</atom:updated>
            <content:encoded><![CDATA[<h3>I ask Open Assistant: How do I make you analyze my Twitter archive which had 13 years worth of data which is 3 GB in file size?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y3vixL7jZ13j8YYv29_uUg.png" /></figure><h3>What is Open Assistant?</h3><p>TLDR, it is an open source version of ChatGPT. You can go the <a href="https://open-assistant.io/">official website</a> to test it right now.</p><p>Below was the answer with oasst-sft-6-llama-30b model and nucleaus9 preset.</p><h4>Here are the general steps to analyze your Twitter archive containing 3GB of data spanning 13 years:</h4><ol><li>Download and install Python, if not already installed.</li><li>Install required libraries: TweetPie (a third-party library used to access Twitter API), pandas (data analysis tool), numpy (numerical computing library). Run following commands:</li></ol><pre>pip install tweetpie<br>pip install pandas<br>pip install numpy </pre><h3>TweetPie DOESN’T EXIST!</h3><p>I knew, but I ask if it understood the mistake. So I asked.. “TweetPie python library doesn’t exist, did you meant tweepy?”</p><p>It answered: I apologize for that mistake. Yes, I intended to say tweepy, which is a Python library used to interact with the Twitter API.</p><h3>The AI continued in explaining the method:</h3><ol><li>Create a Twitter application for accessing the API. Follow instructions at <a href="https://developer.twitter.com/en/docs/basics/authentication/overview">https://developer.twitter.com/en/docs/basics/authentication/overview</a>. Make sure to enable the appropriate permissions for Data Usage and also set a callback URL since Twitter requires one during registration. Afterward, create an Access Token (API keys &amp; secrets). Store them securely, and remember they grant full control over your Twitter account.</li><li>Write code using the tweepy library provided by TweetPie to authenticate and retrieve your tweets. Here&#39;s a sample script that retrieves all tweets posted under a single user&#39;s account:</li></ol><pre>import os<br>from tweepy import Tweepy<br><br># replace with actual values<br>consumer_key = &#39;your_consumer_key_here&#39;<br>consumer_secret = &#39;your_consumer_secret_here&#39;<br>access_token = &#39;your_user_access_token_here&#39;<br>access_token_secret = &#39;your_user_access_token_secret_here&#39;<br>class MyStreamListener(tweepy.StreamListener):<br>    def on_connect(self):<br>        print(&#39;Stream connected&#39;)<br>    def on_disconnect(self):<br>        reconnect()<br>def reconnect():<br>    try:<br>        self.stream.reconnect()<br>    except BaseException as e:<br>        print(&#39;Error while attempting to reconnect&#39;, str(e))<br>try:<br>    # Authenticate via OAuth2<br>    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)<br>    auth.set_access_token(access_token, access_token_secret)<br>    api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)<br>except Exception as error_message:<br>    print(&quot;Error: %s&quot; % error_message)<br>myStreamListener = MyStreamListener()<br>api.user_timeline(&quot;@{screen_name}&quot;.format(screen_name=username)) \<br>    .filter(track=None, languages=[&#39;en&#39;]) \<br>    .listen(mode=&#39;file&#39;, directory=&#39;/path/to/output/directory&#39;, filename=&#39;{screen_name}_all_{time}.csv&#39;.format(screen_name=username, time=int(datetime.now().timestamp())), withdraw=False)<br>while True:<br>    time.sleep(60 * 60 * 24)</pre><p>Replace {screen_name} with your Twitter username without @. Replace /path/to/output/directory</p><h3>Did it answered my Question?</h3><p>Not really, I might as the wrong question. So I ask it specifically:</p><blockquote>How do I analyze my Twitter archive file that I have downloaded from Twitter in my local storage?</blockquote><h3>The Answer</h3><p>You can use the csv module in Python to read your archived .zip file and parse its contents into a format suitable for analysis. Here&#39;s an example of how you could accomplish this task:</p><pre>import csv<br>import zipfile<br>import os<br><br># Open the compressed file and extract its contents<br>with zipfile.ZipFile(&quot;twitter_archive.zip&quot;, mode=&quot;r&quot;) as zipped_file:<br>    zipped_file.extractall(path=os.getcwd())<br># Read the CSV file inside the extracted folder<br>csv_filename = os.listdir(os.getcwd())[0]<br>df = pd.read_csv(csv_filename)<br># Parse the columns by header names, date, text, etc...<br># Use the DataFrame object to filter, group, aggregate, or otherwise manipulate the data<br># ...</pre><p>In this example, we first open the .zip file using the zipfile module, and then extract all files within it into the current working directory using extractall(). We assume that there is only one CSV file inside the compressed file named twitter_archive. Finally, we use the pandas library to read the CSV file and store the resulting dataframe in a variable called df. From here, you can manipulate the dataframe however you like, such as filtering by specific headers or performing statistical analysis on the text data.</p><h3>Using Pandas</h3><p>After parsing the columns, you can perform various types of analyses based on your research goals. For example, you may want to look at the sentiment expressed in the text of the tweets. To achieve this, you can use the NLTK library along with Pandas and count the number of positive and negative words.</p><p>You can install these packages via pip by running:</p><pre>pip install nltk pandas</pre><p>After installing these dependencies, you can create a helper function to count the number of positive and negative words:</p><pre>import nltk<br>nltk.download(&#39;vader_lexicon&#39;)<br>def get_sentiment(text):<br>    pos_count = sum([1 for word in nltk. SentimentIntensityAnalyzer().polarity_scores(nltk.sent_tokenize(text))[&#39;compound&#39;] &gt; 0])<br>    neg_count = sum([-1 for word in nltk.SentimentIntensityAnalyzer().polarity_scores(nltk.sent_tokenize(text))[&#39;compound&#39;] &lt; 0])<br>    return f&#39;Positive Words Count: {pos_count}, Negative Words Count: {neg_count}&#39;</pre><p>Then, you can apply the get_sentiment() function to your entire dataset:</p><pre>row_level_sentiment = df.apply(lambda row : f&quot;{row[&#39;date&#39;]} - {row[&#39;id&#39;]}: {get_sentiment(row[&#39;text&#39;]) }&quot;, axis = 1 )</pre><p>The result will give you a table where each row contains information about when the tweet was sent (date), its corresponding ID (id), and a description of the overall sentiment based on the number of positive and negative words found in the text. This way, you can explore whether the content creator is consistently generating positive or negative messaging around your target keywords over time.</p><h3>Yet to be tested</h3><p>I haven’t test it yet. Might share the report in my next post. Hopefully someone that read this post have tried something on analyzing Twitter archive file.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0b88844d1d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[King of The Universe]]></title>
            <link>https://medium.com/@headsink/king-of-the-universe-68b52bf27b35?source=rss-f7db622cc5a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/68b52bf27b35</guid>
            <category><![CDATA[psychedelics]]></category>
            <category><![CDATA[mindset]]></category>
            <category><![CDATA[share2steem]]></category>
            <category><![CDATA[blog]]></category>
            <dc:creator><![CDATA[headsink]]></dc:creator>
            <pubDate>Thu, 21 Feb 2019 11:29:32 GMT</pubDate>
            <atom:updated>2019-02-21T11:32:32.754Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ppZXLQpqNAPffBMyqUzUxw.jpeg" /></figure><p>Why am I summoning the King of The Universe?</p><p>Whatever that was, I really felt disassociated from the Cough Syrup I took. My eyes were like floating on air conciously watching my sorroundings. I can’t feel my whole body, but my ears seems capable of listening to music with intense depth.</p><p>I was experiencing synesthesia when I close my eyes. The music I was listening turned to shapes of colorful light. Some like a laser beam, firework explosions and changing shapes. Pattern appears and diminished in accordance to the music tempo. The melody translated into shapes which sometimes turned to tiles of geometric perfection.</p><p>The longer I closed my eyes the deeper I gone into a portal of changing shapes. Every time when I thought I was at the end of the portal, another one appears like a blooming flower which petals were projection of past memories or yet to be seen things but known which morph into some other things, repeating shapes and colorful lines.</p><p>Besides the feeling being pulled inside a portal, I also felt the sensation of being push out to the void or another portal. Sometimes I was like hitting a wall, then the wall scattered into many three dimensional balls of the same size. Sometimes I hit a wall that felt like a placenta. It got ripped, and I was like again in that cycle of pulled into a portal, hitting a wall then burst out somewhere else or pushed back out to again another of those portal.</p><p>I had multiple dreams, but I forgot most of it. So to not forget, I wrote this as soon as I awoke.</p><p>Cough syrup sometimes can alter the mind. I never became a warlock like Doctor Strange after visiting the different dimensions. So I advice everyone to not to overdose.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68b52bf27b35" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>