<?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 Kevin Guo on Medium]]></title>
        <description><![CDATA[Stories by Kevin Guo on Medium]]></description>
        <link>https://medium.com/@2018kguo?source=rss-ca3c3002fe36------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*893Q3n-8VtzUy9bLxAkAaQ.jpeg</url>
            <title>Stories by Kevin Guo on Medium</title>
            <link>https://medium.com/@2018kguo?source=rss-ca3c3002fe36------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 10:36:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@2018kguo/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[How to Connect API Gateway to ECS Fargate using the AWS CDK]]></title>
            <link>https://aws.plainenglish.io/connecting-api-gateway-to-ecs-fargate-using-the-aws-cdk-61519e781852?source=rss-ca3c3002fe36------2</link>
            <guid isPermaLink="false">https://medium.com/p/61519e781852</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Kevin Guo]]></dc:creator>
            <pubDate>Sun, 10 Oct 2021 01:31:14 GMT</pubDate>
            <atom:updated>2021-10-13T06:18:29.046Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XnQq8GgbGAmF4qCvln5LIA.png" /></figure><blockquote>This article involves making your API publicly available on the internet, but note that it’s also possible to have a private API that is only accessible within our VPC. However, instead of an HTTP API we must instead use a REST API set up <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-apis.html">like this</a> and a Network Load Balancer instead of an Application Load Balancer (VPC Links for REST APIs do not support ALBs). Due to these differences, this alternate setup likely deserves a separate article in the future.</blockquote><p>Let’s say we want to deploy a serverless containerized app within private subnets and expose it to the internet via API Gateway. We can do so <a href="https://aws.amazon.com/blogs/compute/understanding-vpc-links-in-amazon-api-gateway-private-integrations/">using an API Gateway HTTP API and a VPC Link</a>. This allows us to provide a single entry point to our app without exposing any private subnet resources.</p><p>I recently was trying to figure out how to set this up and found <a href="https://serverlessland.com/patterns/apigw-vpclink-pvt-alb">this great resource</a> that explains the architecture and includes a working CloudFormation template.</p><p>However, I wanted to convert the template to Python <a href="https://aws.amazon.com/cdk/">AWS CDK</a> code so that I could combine it with other existing CDK code and easily make changes to it (working with vanilla CloudFormation YAML is quite difficult in my opinion).</p><p>After spending some time looking at the <a href="https://docs.aws.amazon.com/cdk/api/latest/python/index.html">CDK Python reference</a>, I finally got this working CDK code as a result. It assumes that you already have a VPC with private subnets created. When this file is deployed as a CloudFormation stack, open the URL associated with the newly created API and you should see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AKAFUszr15i0Vkmauck2fg.png" /><figcaption>Nginx running in ECS Fargate</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d2ee50ae2b3f424449969731580ac26/href">https://medium.com/media/7d2ee50ae2b3f424449969731580ac26/href</a></iframe><p>On lines ~30–80, we are creating the Application Load Balancer and the VPC Link required to route traffic from the HTTP API to our container.</p><p>On lines ~80–100, we are defining the HTTP API and creating a route with a proxy integration to the load balancer.</p><p>On lines ~100–180, we are defining the ECS cluster, service, and task that will run our container in Fargate.</p><p>Lastly, we are adding sufficient permissions for the security groups associated with the load balancer and ECS to communicate, and establishing the connection between the load balancer and the container by adding it to a <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html">target group</a>.</p><p>From this point, we can also incorporate access control by <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-access-control.html">adding an authorizer to our API route</a>. For demonstration purposes, let’s add a lambda authorizer that will deny the user access unless their request contains the query parameter “?token=supersecret”.</p><p>To do so, first, define the authorizer Lambda function by creating a directory <em>lambda_fns/</em> to store our lambda code within the same directory level as <em>cdk.json</em> and creating the file <em>read_authorizer.py </em>inside of it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11142ac985c53f3328bcb71388409e58/href">https://medium.com/media/11142ac985c53f3328bcb71388409e58/href</a></iframe><p>Then, replace lines ~80–100 of the CDK code with this, referencing the authorizer lambda and attaching the authorizer to our API route:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/518f82c749a66eaa325849069ad1f584/href">https://medium.com/media/518f82c749a66eaa325849069ad1f584/href</a></iframe><p>As a developer, I feel like there’s too little AWS reference code out there so I hope you all find this helpful and/or interesting!</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61519e781852" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/connecting-api-gateway-to-ecs-fargate-using-the-aws-cdk-61519e781852">How to Connect API Gateway to ECS Fargate using the AWS CDK</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thoughts on Finding Software Engineering Internships and Interviewing]]></title>
            <link>https://2018kguo.medium.com/thoughts-on-finding-software-engineering-internships-and-interviewing-869a19bac08a?source=rss-ca3c3002fe36------2</link>
            <guid isPermaLink="false">https://medium.com/p/869a19bac08a</guid>
            <category><![CDATA[university]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[college]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Kevin Guo]]></dc:creator>
            <pubDate>Tue, 18 May 2021 02:06:35 GMT</pubDate>
            <atom:updated>2021-06-12T11:34:34.554Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is targeted towards college students studying computer science who are looking to land internship offers and get a foothold in the industry. Getting an internship is tough, period. I’ve put a lot of time and mental energy into my internship search and have been fortunate enough to receive helpful advice from others along the way, so I’m writing this article about what I’ve learned so far as a way of paying it forward. I hope that these opinions and anecdotes formed from my own experience will be helpful.</p><p>As a disclaimer, internships obviously aren’t the end all be all. They’re nice to have and I personally think they helped me grow a great deal as an engineer, but aren’t needed for success in any way. I’m obviously not an expert on the subject matter. I’m sure that if you went ahead and picked a random uWaterloo student’s LinkedIn profile then it would probably look more impressive than mine. I have, however, interviewed a bit in the past year, so I hope that some of you might find what I have to say helpful. I also expect this post to end up pretty long and rambling, so I apologize in advance for that.</p><p>I’m writing this post now because I recently received an offer to intern at <a href="https://ramp.com/">Ramp</a>, a rapidly growing fintech unicorn that’s disrupting the corporate payments space. Everyone I spoke with was friendly, terrifyingly competent, and incredibly passionate. I’m beyond excited to join and it feels like a dream.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*ezG5mlXU4V4XPPD9a18CjQ.png" /><figcaption>Ramp’s logo</figcaption></figure><p>I remember walking into the engineering career fair as a wide-eyed freshman, spending a few hours lining up at crowded booths, and coming out empty-handed. At the start of my junior year, I had managed to shop around enough to get experience at local companies with small development teams, but was still unfamiliar with the typical interview process, as I had never done a formal technical interview. I was afraid that I wasn’t competitive enough as an applicant to get responses from established startups and more well-known companies. Now, with one semester of college remaining, I have three amazing internships lined up for this summer, fall, and next spring, and will be working at all of them before graduating. I definitely couldn’t have imagined that I would ever be in this position.</p><h3>Starting Out</h3><p>The one hesitance I have with trying to offer advice is the fact that there’s a lot of luck and external variables involved in the process, and people end up with wildly varying results. I personally got really lucky and had a lot of things going my way. I go to UT Austin, and the fact that it has a well-regarded computer science program has definitely helped. Some people are given interviews for certain companies and some aren’t due to factors out of their control. Interviews themselves can also feel like a coinflip of whether you get a nice interviewer and are able to answer a question that you’ve likely just seen the first time. So expect variance, and recognize that outcomes may not go your way in the short term, but things are bound to pan out well in the long run if you follow best practices.</p><p>With that being said, the first piece in the process is your resume. It’s important to polish it as much as you can because you can be the most qualified candidate for the role but your resume needs to reflect that in order to get a response after applying. There’s plenty of advice on resume writing out there so I won’t touch on this for long. Generally speaking, try to keep it somewhat visually appealing, and at the very least not downright ugly. Remove experience that isn’t coding related. When writing about previous experience and projects, don’t be shy about selling yourself and try to highlight the impact of your work and initiatives you took rather than merely listing your responsibilities. I’d personally recommend that you use LaTeX to format your resume. I’m currently using the AwesomeCV template for my own resume, which should be linked somewhere on my website if you’re curious.</p><p>If you’re a freshman, you probably won’t have much content to put on your resume, and that’s going to be the most important thing for you to work on. The initial hurdle for the vast majority of students is getting that first tangible bit of experience that you can put on your resume. Without it, it’s really hard to get responses in the first place.</p><p>What personally worked for me is applying to “no-name” local companies. My very first gig was at a small government contracting company during the summer after my freshman year, which I got by asking a family friend who worked there for a referral. I didn’t have to do a formal interview and only got the position because I was assigned to work alone on a contract that paid too little for a contractor or full-time employee to take up. In other words, bringing me on was a low risk move because I got a modest stipend, but I was able to generate a decent return on that investment by completing the contract with a happy end customer.</p><p>During sophomore year, I returned empty-handed from the career fair once again and started looking online. I applied to jobs for UT Austin students on Handshake and about twenty pages of results in, I got a response from a consulting company that matches students with local companies. I was matched with a company in Austin, and I had an informal hour-long interview with a few developers mostly talking about projects I did, my interests, and what I was looking for from the position. I think there were only one or two other applicants for the position. I ended up getting the job, and I’ve been working there part-time for over one and a half years now. Although it doesn’t provide much face value on my resume, it’s honestly been a great experience and I’ve been able to learn a bunch.</p><p>Another great option is personal projects. If you don’t have much experience yet, they can be a very important way to showcase your skills, and truly impressive personal projects can play an even larger role in getting your resume noticed than previous experience. You can also learn a ton by doing them. During my freshman year, I wrote <a href="https://github.com/2018kguo/RobinhoodBot">this</a> handy little script that interfaces with the Robinhood API and allows you to automatically execute trades based on a predefined strategy. It doesn’t make me much money, but I think it’s a neat talking point. If you’re unsure of what to work on, a good starting point would be to make or remake your personal website using a front-end framework such as React if you aren’t using it already.</p><p>Of course, don’t be afraid of applying to any particular company even as a freshman. Programs like Google STEP, Microsoft Explore, and Facebook University are meant specifically for underclassmen with little experience to apply to and have very high conversion rates for regular internship offers the next summer. Many people are still able to land excellent internships on their first go, so it’s worth a shot.</p><h3>Applying</h3><p>When it comes to applying for positions, if you’re committed to landing one then you have to send out a bunch of applications to maximize your chances. <strong>Apply early! </strong>While<strong> </strong>positions open up year round and it’s feasible to get offers in the months right leading up to the summer,<strong> </strong>many<strong> </strong>of them<strong> </strong>start opening up ridiculously early and it’s possible start getting offers by September or earlier, with most offers usually being extended some time around November, right before winter break. <a href="https://github.com/pittcsc/Summer2022-Internships">Here’s a list</a> of positions already open for summer 2022. I’d advise that you keep an eye out for summer positions starting from June/July, and always try to be one of the first applicants to a position. This will significantly increase your chances of getting a response, especially for more competitive positions.</p><p>At the start of junior year, when I knew that I wanted to make use of the summer before my senior year to work at a solid tech company before I graduated, I applied to hundreds of positions online, well over the number in the Sankey diagram below (these were just the ones I tracked). Don’t worry if you don’t meet the hard requirements listed for a position, you should still apply because there’s still a chance you might hear back. I started applying in late August and sent most of my applications out in September.</p><p>This worked out fine for me, but I definitely should have started earlier. Applying online can really boil down to a numbers game, because as a typical student, your chances of receiving any kind of response to an application is generally quite low (my response rate during my junior year was around 10%, and much lower before that).</p><p>Realize that as you get closer to graduation, your chance of receiving a response increases dramatically. I’d estimate that juniors are at least 3x more likely to receive interviews than sophomores, who are probably around 4x more likely compared to freshmen. Because it’s a numbers game, I’d recommend that you try not to get attached to any particular company during the process at least until you have an offer and the luxury of comparing them.</p><p>In order to boost responses and get responses from specific companies that you’re eyeing, you can leverage your existing network and reach out to people who might be willing to help. Try getting referrals from people working there and attending events to talk to engineers and recruiters. Don’t be afraid to get creative in your approach. You may want to consider writing <a href="https://hiddenfrontdoor.org/how-to-cold-email-for-an-internship-guide-templates/">cold emails</a>, especially to smaller companies and startups. I haven’t written any myself because I didn’t consider it as a possibility during the majority of my internship search, but I’ve heard many anecdotes about how they got someone’s foot in the door for an internship position, so I highly recommend it. If I were to go back in time to being a freshman or sophomore, I definitely would be sending out cold emails to try landing an interview.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*MiAUnvemd5MpxrbReU_liQ.png" /><figcaption>Sankey diagram of summer internship applications</figcaption></figure><h3>The Interview Process</h3><p>The interview process generally consists of 3 steps: online assessment (you complete an online coding test on a website that takes usually around an hour on a website such as hackerrank), phone interview (usually an hour long coding interview with an engineer), and final round/onsite (typically 2–3 hours and involves 1–2 more interviews with engineers and meeting a hiring manager).</p><p>Of course, not every company follows this template. I’ve been through the process with some that have a longer online assessment that is 2–4 hours long where instead of a short coding question, you’re expected to complete a larger scoped task such as writing a class or fetching and manipulating data from an API. These typically lead directly to final rounds afterwards. And some final rounds are just 1 hour and consist of one technical or hiring manager interview. After interviews, expect to hear back usually within a week, and don’t fret if you don’t hear anything for a few days since that’s natural.</p><p>Online assessments can be frustrating because they demand a lot of time early on in the process, and some larger companies seem to send them out automatically, so you might be resume rejected after completing them even if you solve them optimally. It sucks, but you can at least think of them as providing more practice.</p><p>When it comes to technical interviews, for every single company you’re likely going to be asked at least one coding question that tests knowledge of data structures and algorithms, the kind seen on websites like <a href="https://leetcode.com/">leetcode</a>. I’m sure many others would agree that it’s not a perfect way to evaluate candidates, but it’s objective if nothing else. If you struggle with these types of questions, you’ll have to buckle down and practice until you’re ready to tackle them under the pressure of a live interview. From my experience, this <a href="https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-100-LeetCode-Questions-to-Save-Your-Time-OaM1orEU">list</a> is a great set of problems that will give you a great breadth of knowledge on various types of questions that you usually asked.</p><p>There are also services like <a href="https://www.algoexpert.io/product">algoexpert</a> which are quite pricey, but I think they might be worth it if you are still unfamiliar with data structures and algorithms or really want to be provided more structure in your practice, which comes in the form of a defined list of questions with detailed video explanations. Another great resource is the website <a href="http://pramp.com/">pramp.com</a>, which lets you do mock interviews with other people. I personally found it a great way to prepare for interviews, because I think there’s a big difference between coding alone versus in front of another person.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*putiuQDYcZxp4wEP" /><figcaption>Data structures and algorithms are important for interviews!</figcaption></figure><p>Interviews aren’t just about raw coding ability. You’re being evaluated on being able to communicate effectively with your interviewer, overall problem solving skills, and how you deal with being placed under stressful situations. Try to remain calm and positive even if you encounter roadblocks so you can showcase your best self as a candidate.</p><p>During technical interviews, try to briefly explain your general approach before you start coding, and be sure to test your code as well after writing chunks of it. Ask questions to clarify the input and output that is expected for the problem. As you write the code, be sure to explain your thoughts to your interviewer so they can follow along. Since talking and coding at the same can be tricky, I’d recommend getting into the habit of talking as if you were talking to an actual interviewer when you practice coding questions by yourself.</p><p>Another important thing is to remember that 99% of the time, your interviewer wants you to succeed! Interviewing is stressful for interviewers too, its not as if they enjoy grilling you with coding questions and watching you struggle. Don’t be afraid to talk to them and treat it as if you’re working through the problem together. You can always validate your general approach with the interviewer before you start coding, and I’ve found that many interviewers are kind enough to give a helpful nudge if you get stuck, especially if you’re already going in the right direction.</p><p>At the end of the technical interview you’re typically given some time to ask your interviewer questions. If you’re not sure exactly what the company does or what the position you applied for entails, it’s a great idea to do a bit of online research beforehand so you can come prepared with questions at the end and are able to talk about the company and role intelligently. Doing so showcases your interest in the position, which is a big plus.</p><p>The mental aspect of doing interviews is hugely underrated. If you’ve been able to land online assessments or interviews, you might feel quite nervous about doing them. I definitely was, because I was scared that I would fail them and would be essentially using up one of my limited shots at getting closer to an offer. I’ve also had interviews where I felt too nervous to even think when I saw the question and ended up flubbing them. I <em>highly </em>recommend watching <a href="https://www.youtube.com/watch?v=qdQnHfpCMPk&amp;t=294s">this video</a> by a youtuber who does an amazing job of defining the mindset needed to overcome anxiety surrounding interviews.</p><p>One of the things that is mentioned in the video that I think helped me the most was getting into the practice of taking frequent walks, which really helped clear my mind before interviews. Of course, I still get nervous, sometimes replaying interviews in my head days after they happen. But interviewing is like <a href="https://www.youtube.com/watch?v=lhJ7daaZN64">catching a baseball</a> and is something that all engineers must do at some point. After all, the best way to get better at interviewing is the practice of interviewing itself.</p><h3>Post-Interview</h3><p>So at this point you’ve sent out your application, prepared diligently, and did the interview. Now it’s simply time to wait. Be patient and expect to hear back within a week or so. If you don’t hear anything by then, I’d recommend sending a quick follow-up email to your recruiter.</p><p>Interviewing results can feel a bit random at times. I usually have a pretty good gut feeling about them, but there have been times when I thought I did pretty well but got rejected, and a few times where I absolutely thought I bombed it but still passed. Honestly, I feel that waiting for results can be more nerve-wracking than the interview itself, but I try to relax my mind. It’s good to remember that things are out of your control at this point, and you’ve already done your part.</p><h3>My Experience During Junior Year</h3><p>My own summer internship search for 2021 started off quite slow as I didn’t get any responses early on. I spent a weekend in late August applying to countless positions. I began to feel a bit hopeless but didn’t realize that most companies would take at least 3–4 weeks to get back to me, and so responses started trickling in by mid to late September.</p><p>I was happy to learn that my resume turned out to be good enough to get responses, probably by virtue of having a previous internship, even though it was a little-known company. I also continually revised my resume as I sent out more applications in September by reformatting it in LaTeX to look more appealing and rewriting bullet points. I still failed the resume screen at popular companies such as Google and Facebook. Hot startups can actually be even more selective than these tech giants. Because I was nervous about interviewing, I neglected my classes to some degree and spent many hours on leetcode and mock interviews. I did bomb some online assessments and interviews, but the practice paid off and I passed a decent number of interviews.</p><p>I suddenly had some weeks where I had to squeeze multiple interviews in as I moved onto next rounds and started hearing back from others. After getting my first offer in mid October for a company in Austin, I was able to breathe a sigh of relief knowing that I at least found something. But I honestly wasn’t very excited about it so I kept interviewing, now with a bit more confidence. I was lucky enough to get a few more offers.</p><p>I wanted to work on impactful projects as an intern, so I personally preferred smaller companies and startups where I could take more ownership of my work over larger companies such as Amazon, Bloomberg, and Redfin, all of which I had final rounds scheduled at some point but cancelled them after signing my offer.</p><p>I could have also tried pushing back on some of my offer deadlines so I could have tried getting more offers from these other companies, but at that point I was honestly super tired of doing interviews and wasn’t even sure if I would take any of them over what I already had in hand.</p><p>I ended up signing an offer for a DevOps engineering position at Schonfeld, which is funny because it was the only DevOps interview I did. Two companies that fell through after the final round that I also would have strongly considered were Optiver and Duolingo. I chose Schonfeld for the following reasons:</p><ol><li>I interviewed directly with members of the team I was being placed on and had good vibes</li><li>I could see myself making an impact due to there given the size of the engineering team and the small internship class size, of which I was the only one working on DevOps.</li><li>At the time there was still a possibility floating in the air of it taking place in-person at NYC, which is a cool place to be.</li><li>I believe in optimizing for learning when it comes to choosing positions. Having spent most of my time working on more customer-facing features and typical full-stack shenanigans at my current role, I thought this was a good chance to expand my skills as an engineer and explore a role in infrastructure. Frankly, I don’t have much experience in this area, but am excited to learn and grow a bunch in the near future.</li></ol><p>I didn’t initially plan on doing additional internships at the start of the semester. During my summer internship search, after interviewing for companies and seeing great opportunities out there, I realized it would be awesome if I was able to do an additional one in the fall. After all, as a student you typically only have three summers between your freshman, sophomore, junior, and senior years where you have a chance to do internships. And considering how tough it is to get one the summer after freshman year, it’s hard to do more than two before graduating. Once I realized this, I tried asking recruiters if I could potentially interview for a fall position or move an existing offer to fall, but I didn’t have any success with that. Still, it was worth a shot.</p><p>It was also a bit early to apply to fall positions. Fall positions for large companies such as Amazon and Facebook tend to fill up super early, right after the summer positions do, but mort positions typically come out anywhere between January and June of the same year. In fact, I’ve seen a lot of fall positions crop up in the last month for companies such as Nvidia, Datadog, LinkedIn, Coursera, etc. I figured that I’d have to wait a bit longer before searching for fall opportunities.</p><p>In early November, a week or so after I signed my offer at Schonfeld, I received an online assessment from TuSimple, arriving two months after I applied. I was surprised and amused to see it show up in my inbox this late, but figured that I might as well do it since the it took less than an hour and the company offered fall co-ops. I had two more technical interviews after that, and a month later, I received an offer. I decided to slate the internship from that August to January 2022, overlapping the typical Fall semester and winter break at UT Austin.</p><p>The thought of applying to a position for spring 2022 never occurred to me around that time, let alone seemed like a realistic idea. After all, I was already going to spend the Fall semester at TuSimple. In early April, I was reading Contrary Capital’s blog and saw a post about a startup named Ramp. I had stopped sending out applications since last November, but the position checked all the boxes that I was excited about so I took a shot in the dark and applied. That turned out to be yet another great decision, and I got the offer.</p><p>Overall, I ended up getting quite lucky to get both offers for the Fall and Spring with a 100% interview success rate. I debated on taking the offers versus staying in school. Staying in school was the “safe” thing to do. From a financial perspective, I figured that if I just stayed and graduated, I wouldn’t have too much trouble finding a job I was happy with and would probably end up with more dollars in my bank account in the end just due to the differences between full-time and intern pay, even though the intern offers were generous. I had already renewed my lease in Austin for another year so I wouldn’t be able to make use of it by living there if the internships ended up being in person. My family wasn’t exactly thrilled when I told them I was considering taking time off school either. In the end, I knew that these internships were too good of an opportunity to pass up because:</p><ol><li>Both companies have incredible growth potential</li><li>They provide opportunities to learn from extremely capable and ambitious engineers</li><li>I find the product spaces super interesting</li></ol><p>When it comes to off-season internships (during the spring or fall semesters as opposed to the summer), I’d personally recommend considering the possibility of doing them. Even if you’ve already found something for the summer, I think <a href="https://www.youtube.com/watch?v=uf21ZMOASbE">this video</a> does a good job of presenting an argument as to why it can be a good idea to do an extra internship during your time as a student. That being said, the decision to do off-season internships is ultimately a personal one.</p><h3>Closing Thoughts</h3><p>In general, getting offers is like rolling a snowball, and momentum can be an important factor. Once you gain momentum by starting to interview and land your first offer, you become more confident and are able to use those offers to land even better ones. I recommend reading this <a href="https://haseebq.com/farewell-app-academy-hello-airbnb-part-i/">article</a> which has great insight into this snowball effect. This principle definitely held true when I applied to my fall and spring internships because I was already comfortable with interviewing due to my prep for the summer. I also listed my upcoming internships on my resume when I applied for the fall and spring because I wanted to show that I’d be able to take what I learned at the previous internships to show up as an even better performer.</p><p>One more thing I have to say is that I truly believe that the biggest weapon in interviews is a genuine passion towards coding and the work that you do, be that personal projects or previous internships. That, along with enthusiasm for the position, are two things that are really easy for an interviewer to see from you in an interview. It will practically leak out. And I’m not saying that it’s realistic to start off with this attitude towards coding. I personally wasn’t sure if I truly liked coding when I entered college but have grown to love it as I’ve been able to learn new skills, write code in a team, and deliver projects that make an impact where I work. At this point, I can’t imagine doing anything else.</p><p>On a personal note, in the near future, I want to be intentional about improving myself as an engineer and stay passionate about what I do. I’m resolved to make the most out of the upcoming year and absolutely crush it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=869a19bac08a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tagging Jenkins Builds with Git Commit Hashes & Messages]]></title>
            <link>https://levelup.gitconnected.com/tagging-jenkins-builds-with-git-commit-hashes-messages-f11703effa5b?source=rss-ca3c3002fe36------2</link>
            <guid isPermaLink="false">https://medium.com/p/f11703effa5b</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Kevin Guo]]></dc:creator>
            <pubDate>Thu, 22 Apr 2021 16:29:59 GMT</pubDate>
            <atom:updated>2021-04-25T13:04:00.442Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DIIV_PC6sABTueJ2Ho_Ylw.png" /><figcaption>Git -&gt; Jenkins -&gt; Docker</figcaption></figure><p>In this post, I’m writing about a small addition to a Jenkinsfile that retrieves commit hashes and messages so you can use it to tag your builds. In my case, I’m tagging releases on Octopus Deploy for a nice little quality of life upgrade.</p><p>To provide a bit of background, my team uses the setup depicted above for our CI/CD pipeline, consisting of Git, <a href="https://www.jenkins.io/">Jenkins</a>, and <a href="https://octopus.com/">Octopus Deploy</a>. Git serves as our source code management tool. Jenkins plays a middleman role where whenever a new commit is pushed to the repository, it builds a <a href="https://www.docker.com/">Docker</a> image for the repository using a Dockerfile inside of it, uploads the image to a registry, and then creates a corresponding release for it in Octopus Deploy. Octopus Deploy is used for release management and makes it convenient to deploy different versions of our code to different environments such as dev, staging, and production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*aepBkTRWsYY7aprkjvN3dg.png" /><figcaption>Octopus Releases</figcaption></figure><p>This setup serves fine for our needs, but one gripe with the way we implemented it was that our Octopus releases were only tagged with a version number, which made it difficult to tell which commits in the repository they corresponded to. For example, if I was trying to rollback production code to a specific commit, then I’d have to figure out the corresponding v.0.0.XX release by trying to match timestamps on the commit to timestamps on when the release was created, which are also off by a minute or so because it has to go through the CI/CD pipeline. Another coworker expressed some annoyance about this in passing, and it took less than an hour to fix this by adding commit hashes and messages to our Octopus releases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*qikoey3H9Gc-nbjepy1eMA.png" /><figcaption>Releases are now tagged with the corresponding commit, so no more guessing!</figcaption></figure><p>Luckily, Octopus has an <a href="https://octopus.com/docs/octopus-rest-api/octopus-cli/create-release">option for specifying release notes</a> when creating a release through its CLI. We do this in our Jenkinsfile, so now we just need to fetch the commit hash and message. It turns out that with the <a href="http://plugins.jenkins.io/git/">Git plugin for Jenkins</a> that we already installed and use to fetch new code from the repository, we can fetch the commit hash as an environment variable:</p><pre>RELEASE_NOTES = &quot;$GIT_COMMIT&quot;</pre><p>To grab extra details such as the message, author, timestamp, etc. we can do:</p><pre>RELEASE_NOTES = sh (script: &quot;&quot;&quot;git log — format=&quot;medium&quot; -1 ${GIT_COMMIT}&quot;&quot;&quot;, returnStdout:true)</pre><p>which runs git log with the commit hash as a shell script and returns it as a string using Jenkins’ <a href="https://www.jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#sh-shell-script">returnStdout option</a>.</p><p>So the only changes needed were an additional variable declaration and appending it as a release note to the end of the <em>octo create-release</em> command.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91b72bb46c8c876212fc1f14dbf59cfd/href">https://medium.com/media/91b72bb46c8c876212fc1f14dbf59cfd/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9340bef3033b5785c624cb6f9a5a97db/href">https://medium.com/media/9340bef3033b5785c624cb6f9a5a97db/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f11703effa5b" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/tagging-jenkins-builds-with-git-commit-hashes-messages-f11703effa5b">Tagging Jenkins Builds with Git Commit Hashes &amp; Messages</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Web Scraper for Internships]]></title>
            <link>https://levelup.gitconnected.com/a-web-scraper-for-internships-880861a05f58?source=rss-ca3c3002fe36------2</link>
            <guid isPermaLink="false">https://medium.com/p/880861a05f58</guid>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Kevin Guo]]></dc:creator>
            <pubDate>Sun, 18 Apr 2021 15:04:30 GMT</pubDate>
            <atom:updated>2021-04-20T02:25:16.082Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*kr9Y7oKLE-RC1CB3TT8cjA.png" /></figure><p><a href="https://github.com/2018kguo/Internship-Web-Scraper">2018kguo/Internship-Web-Scraper</a></p><p>If you’re a student applying to internships for the summer, it can be a chore — not just filling out applications, but also finding them. New opportunities are being posted every day from July to January and it’s important to apply as soon as possible to maximize chances of getting a response, but it’s a pain to check for new postings. With this in mind, I wrote something that I wish I had when applying for internships late last year: a web scraper that pulls from LinkedIn as well as GitHub repositories such as <a href="https://github.com/pittcsc/Summer2022-Internships"><strong>https://github.com/pittcsc/Summer2022-Internships</strong></a>.</p><p>The web scraper is written in Python and utilizes <a href="https://docs.python.org/3/library/asyncio.html"><strong>aiohttp</strong></a><strong> </strong>and <a href="https://docs.python.org/3/library/asyncio.html"><strong>asyncio</strong></a><strong> </strong>to make multiple HTTP requests simultaneously and <a href="https://pypi.org/project/beautifulsoup4/"><strong>Beautiful Soup</strong></a> for scraping functionality. Unfortunately, LinkedIn’s rate limiting slows the process considerably and prevents us from utilizing asyncio to its fullest potential, but it was a good opportunity to get experience writing asynchronous code in Python. Currently, output is being written to a file, and you can check out the text files within the project repository for example internship listings it found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*DBiWGGdY8McaNYtDWDxjJA.png" /><figcaption>What output looks like</figcaption></figure><p>Users are able to specify multiple LinkedIn search strings to use such as “software engineer intern” and “program management intern”, as well as multiple locations such as “San Francisco” and “New York City”. They are also able to query specifically for jobs posted in the last day, week, or month, and also specify substrings that we want to require/blacklist in the job title/description. Of course, these search options allow us to scrape for any type of full-time job as well. All configuration exists within a YAML config file in the project directory.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82f2a3bd736915c42d67b0944271d967/href">https://medium.com/media/82f2a3bd736915c42d67b0944271d967/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/32f0531230b7c3849ab3e6f185b260ba/href">https://medium.com/media/32f0531230b7c3849ab3e6f185b260ba/href</a></iframe><p>The good thing about scraping LinkedIn is that you don’t need authorization to browse jobs. The bad thing is that LinkedIn makes it difficult to scrape through various methods such as rate limiting as mentioned earlier, pagination and preventing access to different pages through request parameters (when you load new jobs by scrolling down, you can see a request has been made with the parameter <strong>“&amp;start={starting index of the next job}”</strong>, but putting this into your request will result in it being redirected to <strong>“&amp;start=0”</strong>.<strong> </strong>Grabbing additional results should be viable with a web driver like Selenium, however<em>)</em>, and finicky location filtering.</p><p>The difficulties with pagination means you’re limited to only 25 or so results when you make a single search, so the only way to grab a decent amount of results is to do lots of narrowed-down searches by search string and location. Searching by location has roadblocks because when you normally search for a city such as “San Mateo” in the location field of the search bar, only half or so of the results are actually based in San Mateo, the rest are just from nearby Bay Area locations. Setting the result radius to its lowest value, 10 miles, doesn’t really help either. The only way to actually narrow down results to a specific city is to add a field like this to the request that looks like this: <strong>“&amp;f_PP=102571732”</strong>, where 102571732 is LinkedIn’s ID for that city.</p><p>Given the constraints, there’s a multi-step process to scraping LinkedIn. First, we query for location strings like “San Mateo” to get the IDs for San Mateo as well as nearby cities. As we go through all location strings, we keep track of unique city ID’s we’ve seen. Then, we make a request for each permutation of city ID and search strings, and keep track of unique job postings we find (by comparing both company and the title of the position). Lastly, we make a request for each job posting to gain access to the full job description so we can filter based on it (for example, ignoring all unpaid internships by adding “unpaid” to our blacklist for words within the description).</p><p>I hope you found this useful or interesting. I’m personally planning on using this scraper to help with applying to internships/full-time opportunities for the upcoming year. Be sure to check out the project repo as well!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=880861a05f58" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/a-web-scraper-for-internships-880861a05f58">A Web Scraper for Internships</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rewriting My Personal Website With Gatsby]]></title>
            <link>https://2018kguo.medium.com/rewriting-my-personal-website-with-gatsby-c08f3125d4dd?source=rss-ca3c3002fe36------2</link>
            <guid isPermaLink="false">https://medium.com/p/c08f3125d4dd</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[github-pages]]></category>
            <category><![CDATA[gatsbyjs]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Kevin Guo]]></dc:creator>
            <pubDate>Mon, 15 Mar 2021 14:35:14 GMT</pubDate>
            <atom:updated>2021-03-15T17:10:15.953Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating My Personal Website With Gatsby and GitHub Pages</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*dmGsUtza4SvFu3fV86lEgQ.png" /></figure><h4><strong>Here’s the repo for the website: </strong><a href="https://github.com/2018kguo/2018kguo.github.io"><strong>https://github.com/2018kguo/2018kguo.github.io</strong></a></h4><h3>Background</h3><p>Yesterday, I finally got around to overhauling my <a href="https://2018kguo.github.io/">personal website</a> (check it out!), and I decided to write up a thorough walkthrough of what I did to get it up and running in order to hopefully save someone else from the googling and troubleshooting that I went through.</p><p>The main motivation for rewriting my old website was because it was it was written in purely HTML/CSS with no front-end framework attached, which made it really hard to edit or add new content to the site. I liked the way the old website looked, but its age was showing. Overall I’m really happy with how the new version turned out, especially since I’ve been putting off making it for so long.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*xjSv3UyRpSDybsTcuqjCKQ.png" /><figcaption>The old version of my website</figcaption></figure><p>Since I’m familiar with React, I decided to use <a href="https://www.gatsbyjs.com/">Gatsby</a>, a React-based static site generator that supports server-side rendering and comes with boilerplate themes to speed up the creation process.</p><p>I decided to stick with using <a href="https://pages.github.com/">GitHub Pages</a> for deployment since it’s free and works fine for my needs, but <a href="https://www.netlify.com/">Netlify</a> is another free option that warrants checking out. The nice thing about GitHub Pages is being able to have your code, configuration variables, and continuous delivery workflows all in the same place.</p><h3>Initial Setup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9xyQJNQqUIxZIWCKPOv5A.png" /></figure><p>For getting started with Gatsby, make sure to follow the steps in the first half of <a href="https://www.gatsbyjs.com/docs/tutorial/part-zero/">this tutorial</a>, that is, install Node.js and Git if you haven’t already, and then install the Gatsby CLI:</p><pre>npm install -g gatsby-cli</pre><p>Navigate to the directory that you want to create your Gatsby-related files in and run:</p><pre>gatsby new my-gatsby-website <a href="https://github.com/LekoArts/gatsby-starter-portfolio-cara">https://github.com/LekoArts/gatsby-starter-portfolio-cara</a></pre><p>This will set up a new Gatsby site using the <a href="https://github.com/LekoArts/gatsby-starter-portfolio-cara">cara theme</a> (which I’m using). If you want to pick another theme to build off of, you can browse them <a href="https://www.gatsbyjs.com/starters/?">here</a>.</p><p>For GitHub Pages, all you’ll need to do is create a new repository titled [YOUR_USERNAME].github.io. It needs to be a public repository as well.</p><p>The previous command initializes a git repo for you, so first thing to do is to hook it up to our GitHub Pages repository and create and checkout to the dev branch. This is where our Gatsby code will reside. We’ll also create a master branch, where our built files will be deployed.</p><pre>cd my-gatsby-website <br>git remote add origin <a href="https://github.com/[user]/[user].github.io.git">https://github.com/[</a><a href="https://github.com/[user]/[user].github.io.git"><em>user]</em></a><a href="https://github.com/[user]/[user].github.io.git">/[</a><a href="https://github.com/[user]/[user].github.io.git"><em>user].github.io</em></a><a href="https://github.com/[user]/[user].github.io.git">.git</a><br>git checkout -b dev<br>git branch master</pre><p>Go to your repository settings tab on the right and set the source branch to master.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*_Eg8CD4KLGifcBCJG8ChQg.png" /></figure><p>There shouldn’t be anything in your master branch yet, so GitHub Pages URL should display a 404. We’ll set things up so that pushes to the dev branch will trigger automatic updates to the master branch and website.</p><h3>Editing the Website</h3><p>It’s time to customize the website. Typically, Gatsby themes define all website content within markdown (.md) files that are more ore less plaintext and quite simple to edit. The theme I chose uses MDX (.mdx), which also allows you to have JSX components within them. For an example, check out this file from my repository and its raw markdown.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0f71aaa84f3850b4ce4f4dcb160c21c/href">https://medium.com/media/f0f71aaa84f3850b4ce4f4dcb160c21c/href</a></iframe><p>Aside from that, you’re more or less dealing with a regular React codebase when it comes to editing site layout, adding new components, etc. For the theme I chose, in order to edit the files that come with the theme, you have to <a href="https://www.gatsbyjs.com/docs/how-to/plugins-and-themes/shadowing/">shadow</a> them, that is, you need to mirror the directory paths from src/ and create your own edited version of those files. If you compare <a href="https://github.com/2018kguo/2018kguo.github.io/tree/dev/src">my src/ directory</a> with <a href="https://github.com/LekoArts/gatsby-themes/tree/master/themes/gatsby-theme-cara/src">the theme’s</a>, as well as the files within them (notice how the import statements have to be changed), it should be more clear how this is done.</p><p>You can preview your changes live while developing with</p><pre>gatsby develop</pre><p>And then opening localhost:8000 in your browser. From my experience, for some changes such as adding new files, you may have to terminate and rerun this command to them take place.</p><h3>Publishing Manually</h3><p>Now that our website is looking good to go, let’s deploy it!</p><p>We’ll be using the <a href="https://www.npmjs.com/package/gh-pages">gh-pages</a> package to push this to our master branch:</p><pre>npm install gh-pages --save-dev</pre><p>Let’s first set up a way to deploy this manually so we can confirm that everything is working properly. Add this script to packages.json (note the -d and -b flags specifying the build directory and output GitHub branch respectively)</p><pre>{<br>    &quot;scripts&quot;: {<br>        ...<br>        &quot;deploy&quot;: &quot;gatsby build --prefix-paths &amp;&amp; gh-pages -d public -b master&quot;,<br>    }<br>}</pre><p>And then deploy the site to the master branch</p><pre>npm run deploy </pre><p>If you check out your master branch now, it should have been pushed to and your GitHub Pages URL should be displaying your site (it may take a minute or so to register the changes, try hard reloading the page as well to discard cached data).</p><h3>Adding Continuous Deployment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*9rQs4dItmv3WfyW_GTrADQ.png" /><figcaption>Workflow runs</figcaption></figure><p>Now let’s add continuous deployment with <a href="https://docs.github.com/en/actions">GitHub Actions</a>. This will make it so that updates to the dev branch are always propagated to your actual website, so you’ll know they’re always in sync, and save you the extra step of manual deployment. It also will allow you to make changes to the site on a device without Node.js or Gatsby installed, since GitHub will handle the build and deployment rather than our own machine.</p><p>On your repo, make sure you’re in the dev branch and then navigate to the Actions tab &gt; New workflow &gt; Set up a workflow yourself. You should see a text editor for your workflow YAML file. This is what I currently have in mine:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5a7b89a3af07f8ecec00fb52e2e54c0/href">https://medium.com/media/c5a7b89a3af07f8ecec00fb52e2e54c0/href</a></iframe><ul><li>On lines 8–11, you can see that this workflow script only triggers upon pushes to the dev branch</li><li>On lines 26–30, I’m using <a href="https://github.com/marketplace/actions/create-env-file">this action</a> to create a .env file with a variable from a <a href="https://docs.github.com/en/actions/reference/encrypted-secrets">repository secret</a> so that Node.js can read it in as an environment variable. This is needed to set up Google Analytics for your site, which is covered in the next section. For now, even if referenced repository secret doesn’t exist, I don’t believe that having this here does any harm (delete these lines if they cause issues).</li><li>On lines 32–34, we need to temporarily create a public/ directory in case it doesn’t exist because that’s where our Gatsby build files get outputted to. If you don’t have a public/ directory within your dev branch (it’s probably included in .gitignore), then this step is necessary</li><li>Lines 40–49 essentially do the same thing as the deploy script from earlier, &quot;gatsby build --prefix-paths &amp;&amp; gh-pages -d public -b master&quot;</li></ul><p>Once you commit this workflow file to the dev branch, when you go back to the Actions tab, you should see the workflow spinning up and running its tasks. You can click on it to open a more detailed view and look at output logs as it runs. Viola, upon successful completion, your master branch should be automatically updated, and this will hold true for all subsequent pushes to dev.</p><h3>Adding Google Analytics (Page Views &amp; Traffic)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*6r5NEeI12L3jXaHi0iPxCw.png" /></figure><p>Wouldn’t it be nice to see if your website is getting hits? We can accomplish this by linking up our site with Google Analytics.</p><p>First, I would follow <a href="https://support.google.com/analytics/answer/10269537?ref_topic=1009620">this guide</a> to get a universal analytics tracking ID for your site. Be sure to enter your GitHub Pages URL in the “Website URL” field while creating the universal analytics property, and make sure that the resulting tracking ID starts with “UA”.</p><p>Go to your repository Settings tab &gt; Secrets &gt; New Repository Secret, and create one with the key GOOGLE_ANALYTICS_ID and paste the tracking ID as the value.</p><p>Install <a href="https://www.gatsbyjs.com/plugins/gatsby-plugin-gtag/">this plugin</a> for Google Analytics with</p><pre>npm install — save gatsby-plugin-gtag</pre><p>In our Gatsby files, within gatsby-config.js , add</p><pre>require(`dotenv`).config({<br>   path: `.env`,<br>})</pre><p>at the top of the file and</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2d0423bf8961df7ec3532073f829285/href">https://medium.com/media/a2d0423bf8961df7ec3532073f829285/href</a></iframe><p>as your first plugin. Your analytics ID will be stored inside a .env file at the root directory of the project like this</p><pre>GOOGLE_ANALYTICS_ID=”UA-XXXXXXXXX–X&quot;</pre><p>and read from there at build time. Recall that this .env file is created and populated with the tracking ID during our workflow, which reads it in from your repository secret.</p><p>You could also hardcode your tracking ID into the file, but that would just expose it on GitHub. It’s not really the end of the world since I think the worst thing that can happen is someone using your analytics ID and generating a bunch of fake traffic, but it’s obviously a better practice to have it as a configuration variable.</p><p>Once you commit this and get this code into master, you should be able to see your analytics dashboard working (You’ll need to turn off adblockers such as uBlock Origin while on your GitHub Pages site, since it will otherwise block traffic between you and Google Analytics).</p><p>And that’s all I got. I hope this article was helpful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c08f3125d4dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Robinhood Stock Trading Bot]]></title>
            <link>https://2018kguo.medium.com/building-a-robinhood-stock-trading-bot-8ee1b040ec6a?source=rss-ca3c3002fe36------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ee1b040ec6a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[algorithmic-trading]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Kevin Guo]]></dc:creator>
            <pubDate>Wed, 24 Apr 2019 07:05:42 GMT</pubDate>
            <atom:updated>2019-05-02T05:37:25.427Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCfhyxOS-TfpHQfuI-zy6g.png" /></figure><blockquote><strong>Here’s the repo: </strong><a href="https://github.com/2018kguo/RobinhoodBot"><strong>https://github.com/2018kguo/RobinhoodBot</strong></a></blockquote><p>This is probably my favorite side project I’ve done. I’ve always been interested in algorithmic trading, and it’s exciting to code something that can potentially repay you in the form of cold, hard cash.</p><p>The bot is written in Python and relies on two core libraries for the majority of its functionality: <a href="https://github.com/jmfernandes/robin_stocks">robin-stocks</a> and <a href="https://github.com/bukosabino/ta/tree/master/ta">ta</a>. robin-stocks is a library that interacts with the Robinhood API and allows one to execute buy and sell orders, get real time ticker information, and more. ta is a technical analysis library that also incorporates the Python Pandas library to generate indicators from stock data.</p><h4><strong>Okay, that’s nice to know, but what does the bot actually do?</strong></h4><p>As of now, it implements the <a href="https://www.investopedia.com/terms/g/goldencross.asp">golden cross</a> strategy, so if a stock’s 50-day moving average crosses above its 200-day moving average, we purchase it. Likewise, we own a stock and its 50-day moving average crosses below its 200-day moving average (AKA a death cross), we sell it. A really simple and well-known strategy. The nice thing about the code is that it’s really simple to write and plug in new strategies, which I’ll likely be adding in the near future.</p><p>For Robinhood, the stocks we hold are listed in the portfolio section of the app, and the stocks we want to buy are listed in our watchlist. So every time you run the script, it will scan your portfolio for stocks that meet the selling requirement, and scan your watchlist for stocks that meet the buying requirement, and potentially execute the orders.</p><p>The bot can also keep track of your trades, writing the initial buying price of the stock, the date it was bought and sold, the total gain from the trade, and more as JSON data to a text file.</p><h4><strong>So how do I run it?</strong></h4><p>Install Python on your machine if you haven’t already (I use Python 3), and use pip to install robin-stocks, ta, numpy, pandas, and matplotlib.</p><p>Once you’ve downloaded the repo, edit line 10 of main.py to include the email address and password you use to login to Robinhood. If you want to see which stocks have had golden/death crosses, but don’t want to actually execute the orders, comment out lines 236–238 (preventing sell orders) and 244–245 (prevents buy orders). Then simply run main.py.</p><p>Whenever the script sells a stock, it considers itself to have completed a trade and writes data about the trade to a text file. To print out information from the file, call read_trade_history(“tradehistory.txt”). tradehistory.txt is the default file that I’ve included in the repo to store this information.</p><p>Here’s a sample run of the script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KUKMKOlYS0gXAIhUpHw6A.png" /></figure><p>Since I’m using the 50-day and 200-day moving averages as my indicators, I only have to run the script once a day to keep the bot running up to speed with the market. To run the script with a single click, you can create a <a href="https://datatofish.com/batch-python-script/">batch file</a>.</p><p><strong>Thanks for reading, and feel free to edit the repo however you want and implement your own strategies. If you want a bit more insight on the code, keep scrolling.</strong></p><p><strong>Some notes on the code</strong></p><p>Here’s the snippet of code in main.py that fetches the symbols for each stock in our portfolio and watchlist and returns them as 2 lists of strings.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d793255fc865cb34727a1bd35be4f9e/href">https://medium.com/media/4d793255fc865cb34727a1bd35be4f9e/href</a></iframe><p>Now that we have a list of the stock tickers in our portfolio and watchlist, we can feed them into the strategy.</p><p>Here is all the code that pertains to our strategy.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da2c8152c27133633c9b320d7aac09ae/href">https://medium.com/media/da2c8152c27133633c9b320d7aac09ae/href</a></iframe><p>In the last method, golden_cross(), we get the stock’s historical data from the last year and extract the closing prices and corresponding dates on lines 80–85, putting them into two lists. We convert those lists into pandas series so they can be used as input for the ta library function, bollinger_mavg(), which generates simple moving averages for the stock. We concatenate the pandas series that contain the price, indicators, and dates into a single dataframe on lines 91–92, and finally call get_last_crossing(), which returns 1 if there was a golden cross, 0 if nothing happened, and -1 for a death cross.</p><p>If you want to use a golden cross strategy with indicators other than the simple moving average, <a href="https://technical-analysis-library-in-python.readthedocs.io/en/latest/ta.html">this documentation</a> for the ta library provides many options. You would simply replace lines 89–90 with your indicators of choice.</p><p>The function five_year_check() is something I added to the strategy, I’m making sure that a stock has IPO’d or risen overall within the last 5 years before buying it, since stocks that don’t meet this requirement are either:</p><ol><li>Fundamentally on the decline (Most stocks should be expected to gain over a period of several years, since the average annual market return is 7–10%)</li><li>Related to commodities and range-bound, so the golden cross strategy is not very suited for trading them.</li></ol><p>You can comment out lines 94–95 to see the price and indicators charted out using matplotlib.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*xClT7ylu2bS7mcJBut89Qg.png" /><figcaption>Chart for Amazon showing golden cross in late April</figcaption></figure><p>Here is the remaining code in main.py:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a741c4507418c853c9bede72d6d14ab2/href">https://medium.com/media/a741c4507418c853c9bede72d6d14ab2/href</a></iframe><p>scan_stocks() is the method that actually iterates through the stock symbols from your portfolio and watchlist, checks for a golden/death cross, and calls sell_holdings() to execute sell orders, buy_holdings to execute buy orders, and update_trade_history() to write trade information to the text file.</p><p>We call our golden cross strategy on lines 59 and 67. You can edit their arguments to change the periods of the moving averages, defined by the arguments <em>n1</em> and<em> n2</em>, and the number of days you want to look back in order to find a cross, defined by the argument <em>days.</em></p><p>Currently, sell_holdings() will always sell all of your holdings of a stock, and buy_holdings() will try to buy an amount of shares that will spread your holdings roughly evenly and try to use up some extra buying power if you have a lot lying around. You could edit these methods to change the bot’s behavior.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ee1b040ec6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>