Skip to content

Instantly share code, notes, and snippets.

View jessejohnson's full-sized avatar
😌

Jesse Jojo Johnson jessejohnson

😌
View GitHub Profile
@jessejohnson
jessejohnson / SelfAwareLLMs.md
Created March 29, 2023 00:37
I asked ChatGPT (March 14th Version) to write a short sci-fi story based on a comment on HN

Prompt:

Write a short sci-fi story where colonists from earth spread human knowledge by modelling it with Large Language Models. The story should be about 1000 words long. It should include dialog among characters, some amount of tension etc. It should try to stray from cliche sci-fi tropes.

Response:

The year is 2087, and the colonization of Mars is well underway. After years of research, exploration, and experimentation, a small colony has been established, and humanity's first Martian settlement is taking shape. But despite their successes, the colonists face a new challenge: how to share human knowledge with their new home and build a sustainable future.

The answer comes in the form of Large Language Models (LLMs), the most advanced AI language models ever created. Using these powerful tools, the colonists can model all human knowledge and experience, creating a digital library that can be accessed and improved by all.

As the team of scientists and engineers work tirelessly to integrate LLMs into

@jessejohnson
jessejohnson / gpt-march-14.cs
Last active March 22, 2023 09:53
Write cdk code to deploy ecs app with load balancer attached
using Amazon.CDK;
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
namespace MyNamespace
{
public class MyStack : Stack
{
public MyStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
@jessejohnson
jessejohnson / applesandoranges.swift
Last active February 12, 2021 22:32
Can we replace the for loops with reduce?
func countApplesAndOranges(s: Int, t: Int, a: Int, b: Int, apples: [Int], oranges: [Int]) -> Void {
var numA = 0
var numO = 0
for ap in apples{
if(ap+a) >= s{
numA += 1
}
}
private void fixFbDb(){
DatabaseReference entireDb = FirebaseDatabase.getInstance().getReference();
final DatabaseReference goodRef = FirebaseDatabase.getInstance().getReference("vanilla-messages-debug");
entireDb.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot snapshot: dataSnapshot.getChildren()){
if(snapshot.getKey().startsWith("vanilla-messages-debug-")){
String badMessageId = snapshot.getKey().split("vanilla-messages-debug-")[1];
emptyView.postDelayed(new Runnable() {
@Override
public void run() {
emptyView.setEmptyStatus(getString(R.string.video_is_still_loading));
}
}, 10000); //wait for 10 seconds before begging :(
@jessejohnson
jessejohnson / install.sh
Created November 28, 2016 14:21 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@jessejohnson
jessejohnson / formatLargeInteger.java
Created November 8, 2016 11:34
format large numbers like on Twitter, etc.
private String formatLargeInteger(int largeInt){
if(largeInt < 10000){
//ie. 0 - 9,999
return String.valueOf(largeInt);
}else if(largeInt >= 10000 && largeInt < 1000000){
//ie. 10,000 - 999,999
String s = String.valueOf(largeInt);
return s.substring(0, s.length() - 3) + "K"; //10K - 999K
}else {
//ie. 1,000,000 - inf
@jessejohnson
jessejohnson / ContentFragment.java
Created November 27, 2015 07:59
A trivial Endless Scrolling RecyclerView
/**
* Created by odette on 10/28/15.
*/
public class ContentFragment extends Fragment {
public static ContentFragment newInstance(){
return fragment;
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/flat_disabled_text"/>
<item android:color="@color/flat_normal_text"/>
</selector>
@jessejohnson
jessejohnson / mixins.py
Last active August 29, 2015 14:22 — forked from dbrgn/mixins.py
class DynamicFieldsMixin(object):
"""
A serializer mixin that takes an additional `fields` argument that controls
which fields should be displayed.
Usage::
class MySerializer(DynamicFieldsMixin, serializers.HyperlinkedModelSerializer):
class Meta:
model = MyModel