HACKER Q&A
📣 lucasknight

How do I code offline for a week?


I'm going to be going to the middle of nowhere for a couple of weeks, and there's going to be no internet there.

I design with Figma and I code in React Native/ReactJS. How can I build something or learn a skill with no internet to make sure I'm productive over this time?


  👤 jacobn Accepted Answer ✓
Starlink?

Not meant to be snarky, sorry I just don't have any idea how you'd get local setups and then have the relevant developer docs in an accessible manner. Maybe a locally running Llama model?


👤 vpaulus
Do you really need to code on a vacation? (I assume this is not a job-related trip if the destination is the middle of nowhere.)

👤 b20000
print it all on paper and design and code on paper.

👤 sen
Try another language for the time you’re away. I spent 2 weeks in hospital and spent it offline playing with PICO-8 by downloading the PDF references and just experimenting.

Doesn’t need to be PICO-8 but there’s plenty of languages that can be done entirely offline.

Still keeps your brain active and lets you learn something new that might help you in parallel ways.


👤 eszed
I don't know the circumstance of your tech exile, but I'd encourage you to take advantage of it to do something other than code! If you're going to be in nature, be in nature. If you're going to be with people, be with people. Those are the sorts of experiences you'll treasure, later in life, far more than a few more days of "productivity".

If none of that applies, and you still want to learn something to do with tech? Well, you know this won't be an ideal situation to engage directly with a system. How about zooming out a bit? Read some books. Some of Stallman's essays. Clifford Stoll. Or anything else more recent that you think is big-picture significant to your field. Your situation will be ideal for contemplation, which will in the long-term make you a better contributor to whatever projects you take on.


👤 dharmab
grab a textbook and work through it

👤 abrichr
See https://devdocs.io/ for offline documentation.

👤 choilive
A colleague of mine had to do this regularly when working on certain projects for the gov. It was an air-gapped environment. So no access to the internet.

This basically meant loading up a thumb drive of all the possible documentation he could get. You can use site archive tools to download an entire website's documentation. Depending on the complexity of what you want to build - you would also probably need to mirror a subset of your package manager i.e. npm mirror. Probably lots of eBooks, courses, tutorials. Nowadays maybe even a LLM might be a useful reference.


👤 winrid
Don't. Sit outside and just exist for once :)

👤 cozzyd
Do any languages other than C provide decent man pages?

👤 tempaccount1234
There’s stuff like https://zealdocs.org/ that allow you to take all relevant documentation with you so offline coding will work.

If you just want to be productive, you could also bring a lot of books or downloaded tutorials on a drive.

Btw, make sure your drive is encrypted and you think of a way to backup your data so you don’t lose the offline progress.


👤 Loxicon
Coding in your local dev environment doesn't require internet.

localhost... right?


👤 02092023
Better take reference guides of above mentioned technologies with you.

👤 steinso
If I were you, I'd make sure I have a local instance of f.ex Llama 2 and Code lama up and running.

Even though it's not as good as GPT-4, and might even be slower, the value you might get from a local modal in such a case will probably beat most other things. It will allow you to both look stuff up, and even learn new things without needing to copy large parts of potentially irrelevant information beforehand.


👤 dusted
>to make sure I'm productive over this time?

Is the purpose of the retreat to the middle of nowhere to be productive ?

Why do you think you need to make sure you're productive ?

If the purpose of your retreat is to be productive, maybe chose something that you can do without Internet, like programming in a language/framework you feel comfortable with, and just bring their documentation with you ?


👤 walthamstow
Not quite as long as a week but here are some tips when I want to code from a long haul flight or some other offline situation.

- The replacement for Figma is straightforward - pen and paper. Make sure you take some.

- devdocs.io for offline docs or if what you're using isn't in there, a lot of packages offer a PDF of their docs.

- I keep a pyproject file that has basically any mainstream package I am likely to want at any point while writing Python, then when I leave for a trip I make sure everything is installed locally. Docker can also be helpful for this.

- Sometimes I write tests when I have internet then when I'm offline I just spend the time making the tests go green.

- Other times I will forget about writing new code and learn something new by working through the PDF of a book. Most technical books set up the dev environment in the first few pages, do that when you have internet then you're good to go.

Other people have raised good points about getting away from your computer. I don't want to preach but I do like a 'holiday' day where I do some light coding in the morning then spend the afternoon doing something else entirely.


👤 mschaef
I tend to agree with the other commenters suggesting you just step away from the keyboard for a while. I've been programming for 40 years... it can be addictive, fun, and useful... but there are other and more important things in life. Focus on those.

If that advice falls on deaf ears, and you really do want to write code on your time off, then here are some suggestions. I was about to say 'welcome to how we used to code'... but there are differences, both positive and negative.

* Tools like `git` are invaluable to the extent they let you manage source code control offline. Use them if you don't already.

* Settle on your dependencies and frameworks while you have network access. Download all the source you can for future reading.

* Focus on algorithmic work.... places where it's more about thinking through the code you're writing rather than interfacing with something else. (Hard these days.)

* Buy and bring some books. There are still good programming books that can be useful. You won't be totally at the cutting edge with these, but you probably don't need to be either.


👤 joshxyz
i would say dont.

unplug instead and consider it as a break.

youll just get disappointed once you encounter edge cases where you need more than the official documentation. i mean things that are hidden in github issues and stackoverflow posts.

it's okay to take a break anon, everythings gonna be okay.


👤 da39a3ee
[delayed]

👤 thih9
Can you elaborate what does “no internet” mean in this context?

Is there no way to go online for all duration of the trip?

Or is there some device that you can use occasionally to browse or perhaps even download something to an usb drive?


👤 gizajob
Pen and paper

👤 quickthrower2
Time to git clone the docs to all your tools. Mozilla MDN etc would be worth downloading. Make sure you have all your local infra like DBs running on your machine.

I did an hour of coding today disconnected from the internet and it was nice. Some things have to be put off but there is a surprising amount you can do!


👤 brudgers
[delayed]

👤 FlyingAvatar
Assuming you're fixed on not disconnecting:

I would recommend using ollama (or install llamacpp if you're on Windows) to bring along a modestly capable LLM you can run locally such a CodeLlama or Minstrel. They won't be as capable as ChatGPT, but a lot of knowledge gets compressed into these relatively small models.


👤 Clubber
Buy a book or two on the subject and read it. That's what we did before the internet.

👤 sokoloff
I lived aboard a boat for a week this spring with no internet access. We spent most of our waking time doing Galapagos things, but many of the multi-hour transits between islands there wasn't much to do.

I had downloaded a bunch of older Advent of Code exercises and spent some time on the transits solving them in a language that was relatively new to me (Clojure).

That might be better suited to a casual/low-stakes "15-20 total hours" rather than 100 hours where you want to be sure you can be productive, but all I did was just made sure I could do a couple of hours worth of work on my laptop at home with the wifi disconnected.


👤 SwiftyBug
If you're not familiar with Vim, I'd encourage you to download a few Vim cheatsheets, the VimBeGood extension[1] and practice navigating code in Vim.

[1] https://github.com/ThePrimeagen/vim-be-good


👤 petespeed
Cloud-cutting is an interesting journey, even if temporarily done.

Some offline alts:

1. Penpot for ui design 2. Llama for stackoverflow (from this thread, yet to try myself) 3. Python had devpi to cache packages. You might find something similar for npm.

I also found vscode plugins are mostly offline. A nuc-style box with docker + glinet router may help if you are not alone on this journey.

It might not align with current trend, but I would like to make cloud-cutting a norm, instead of exception.


👤 da39a3ee
[delayed]

👤 karmakaze
I would suggest just one aspect, whether designing (find an offline tool), building (take offline React reference docs), or something else and go deep into that. Typically I take a toy project and build it with a different language/style and framework (or without a framework).

If I were in a circumstance like that I might take Ruby & Rails docs. I use it, but don't know to the point of memorization so many things that are uncommon but frequent enough that I have to take time to look them up each time they come up. Like how does Ruby symbol resolution work, exactly.


👤 slavapestov
Get a math or CS textbook and try solving some of the exercises.

👤 matt_s
I don't work with React directly but I'm aware with JS apps that a lot of package repos are needed to build so can all that work without internet (i.e. npm install, etc.)?

The good thing is you can practice this ahead of your retreat by turning off your wifi and trying to do work that you might do on your retreat. Then when you encounter something you need, figure out how to download it and run/install it locally. Then repeat until your local setup allows you to do work. The downside is you'll be limited to what you prepare ahead of time so there won't be any exploring available packages, downloading one to see if it works, etc.

Another approach is to try and learn something new with a book, that amount of time with a new language/framework and being new to it means you probably only need some basics to get going. You might want to download api/language docs in addition to the book as well in case you explore things outside of the scope of the book. Maybe try something adjacent to what you work on.


👤 jacknobody
I got "allergic" to computers but I still like algorithms and playing with mathematical/logical structures. I spent some time in the Australian outback with nothing but a pencil and a block of paper. I had heard of topology in science fiction books so I decided to study that from scratch. Soon I had discovered a family of hyperdimensional geometries that led me to an efficient algorithm for the complete resolution of a traveling salesman problem and a non-Boolean logic. Therefore I think that creativity (work!) in preparation for coding doesn't need anything but a curious mind.

👤 justinlloyd
[delayed]

👤 bluecheese452
I was actually in this situation recently. Download everything you need, dependencies, editors, programming books, docs. Enjoy the distraction free time!

👤 dev_0
Do it localhost? Make sure you download all dependencies before you go offline

👤 seabass-labrax
I would suggest setting up a 'forward proxy' on localhost with a piece of software such as nginx. With a sufficiently large hard disk or SSD, you can set the cache lifetime to be something very long like a month or two. Ideally, you'll be able to have your most frequented Web pages available offline. In practice, I've found DNS to be the biggest challenge, as browsers like to check the domain name too frequently; you'll probably need to cache that as well. I can share a prototype nginx configuration that I have been trying, if you like.

More immediately, Kiwix is fantastic for this. I have the entirety of Wiktionary downloaded - the complete "English to X dictionary" where X is about 50 languages - and it only takes up 8GiB. Install at least two different Kiwix client applications; there are occasionally glitches that make one unable to show a certain page. Wikipedia and Stack Overflow might be good Kiwix libraries for your use-case.


👤 phendrenad2
[delayed]

👤 throwaway128128
Get a bunch of manuals so you can RTFM.

👤 runjake
Ensure you have offline copies of books and documentation you might need and perhaps some cloned repos that might be helpful.

You didn't provide any details about this excursion, so I'm not going to assume anything and tell you to do something else.