1,787 karma · joined Oct 29, 2013 (13y ago) · 405 submissions
author: The Tao of tmux (https://leanpub.com/the-tao-of-tmux) available to read for free online at https://leanpub.com/the-tao-of-tmux/free
software libraries: cihai, unihan-etl, tmuxp, libtmux, vcspull, libvcs
tony (at) git-pull.com
https://www.git-pull.com
(If what I say isn't helpful to you, disregard it. Spread the good will and good tidings!)
comment 9y ago · link · parent
To add, if using Django Debug Toolbar, there is a line_profiler [1] extension for it: https://github.com/dmclain/django-debug-toolbar-line-profile...
comment 9y ago · link · parent
To the author:
What do you feel about binding python to rust? Did you use any tutorials?
[1] https://github.com/tbodt/htmlpyever/blob/880da57/setup.py#L5
comment 9y ago · link · parent
comment 9y ago · link · parent
I read the page, I liked it. It shows a try/catch is how it'd be done.
> In Java, the "class cast exception" is a somewhat different concept. Even if both classes support the same method, you can't cast between them if they don't have a superclass-subclass relationship.
I find that fascinating. But still, another case where it's more a rule and intricacy of the language.
This is the latest C++17 draft (2017-03-21) http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n465....
So here's why I go on about it being an intricacy of the language: The amount of casting / type rules and so on in C++, for instance, is mind-boggling.
> The core difference is "late binding" -- in languages like Smalltalk, the mapping from names to methods is evaluated at runtime
Which is interesting. And cool.
Isn't that similar to, an extent, virtual functions / vtable'd methods in C++?
But how does this wrap into C++ not handling an aspect of OOP? In your words. Even though I feel #doesNotUnderstand is a sugar and not necessarily a whole OOP concept, I think it can handled via an event system and try/catches.
comment 9y ago · link · parent
Despite it looking cool and useful, IMO it's more of a (quite pleasant) sugar than an OOP concept. There's also a try/catch example where you'd get similar behavior.
I feel this is a bit opinionated:
> "but this is clearly rather verbose and it has to be repeated for every call."
I think the example in the link is what try/catch is meant for. Message passing systems in C/C++ handle situations where a disabled/unavailable service receives communication and recovers.
As for C++ and replacing objects:
I feel this is also a language-specific gotcha that doesn't hinder a learner understanding OOP. But C++ has many more gotchas than that.
For instance, there's no pure "interface" keyword. It can still be done (and is), code example: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines..., how Google Style guide defines it: https://google.github.io/styleguide/cppguide.html#Interfaces
comment 9y ago · link · parent
- ECMAScript 5
Mixins, scopes, instance variables, and instantiation.
As a bonus, but not OOP, callbacks. It's a straight-forward language that's available abundance.
- Python
For it's class inheritance being easy to navigate. Instance variables, instantiation, method resolution order (MRO), mixins.
- C++
This is the hardest language I can think of. It does everything OOP, and more, including allowing for a lot of stuff that's not legible.
Despite that, it's a solid language.
Something that goes great with constraining the many features of C++ are https://google.github.io/styleguide/cppguide.html or https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines.
I think ES5 and Python are used very often and in terms of bang for the buck, give they cover a lot of the bread and butter OOP concepts.
comment 9y ago · link · parent
https://github.com/zzzeek/sqlalchemy
http://docs.sqlalchemy.org/en/latest/
https://www.youtube.com/watch?v=vunIDi9Z-_8 (Introduction to SQLAlchemy, 2014, 2:52:50)
http://www.aosabook.org/en/sqlalchemy.html (Overview in The Architecture of Open Source Applications)
comment 9y ago · link · parent
2. Link to the documentation (https://docs.servicebot.io/) instead of the company page
3. Any travis-ci up yet?
4. Give reddit a try (for the open source project), /r/node, and /r/javascript
5. Consider "spin-off" libraries of reusable components. Make them available via NPM. Give them documentation as well. Creating a popular dependency library attracts more interested users.
6. Did you apply for Y Combinator yet?
7. Try to contact AdWords to see if you can get free credits to advertise the corporate website. Bing has some too. It may not give much but even one or two clients would be a sign of momentum.
8. Consider contacting startups and offering your service free / discount in return for feedback and a testimonial
9. On the website, try an intercom.io widget. It makes it easy for people to open up a chat window to reach you.
comment 9y ago · link · parent
Invoke: http://www.pyinvoke.org/ wraps subprocess commands into Makefile-like tasks
Fabric: http://www.fabfile.org/ Same as invoke, but catered to remote subprocess commands over SSH
comment 9y ago · link · parent
If you build your models to be an exact fit with your current data, yes.
> Based on the website and code base i have, i just want a rough estimate..are we talking 2 weeks, 2 months or 6 months here to rebuild in a new language?
That's like asking a consultant for a time estimate when they don't know all the details. Factors include:
- How much python you know already
- How long does it take for you to grasp the fundamentals of virtual environments, packages, importing, etc.
> trying to see if something can be reused or is it gonna be a total build from scatch new website..
- Good point: If you end up keeping old API's running on the PHP side and just migrating the HTML stuff first, or only. That is a shortcut to get going faster.
- How much templating you have to do. But I think you can do that in maybe (2 Weeks). Django templates are easy to learn and you can extend from a common base.
- Database models. I think you should try the inspectdb thing ASAP as a trial to see how easy it is to display any data from your current schema. Be sure to use a copy (or sample) of your prod data in a separate staging database though. You could do that tonight. Getting everything (relations and all) to map perfectly (ORM -> your current db schema) could take a couple of weeks to get perfect. Use this 'managed = False': https://docs.djangoproject.com/en/1.11/howto/legacy-database...
- Development hosting: I recommend trying out Heroku. The deployment is straight forward. But outside of that you're going to have to wrap your brain around how to deploy it. nginx + uwsgi + supervisor is a common combo if you're doing it right on the server.
- Business logic: Most of this is done inside your views. This could take a month or so.
Since django is a big framework and these things work in tandem, it could be 3-6 months. Remember to build it in parallel so the PHP site can continue to be maintained if needed. And create a staging database that's based off your production schema with some sample data in there.
Also while you do this, you're going to continually get faster as you gain mastery with python.
For a speed boost, you can continue to keep API's running in PHP while you convert other stuff over first.
comment 9y ago · link · parent
If you're not doing so already, create a staging database you can use for developing this. That way if something goes berserk production data stays safe.
Get a jumpstart by using Django and creating models that match your database via inspectdb [1]. Most important thing is getting the data to fit and relate as you'd expect.
Some recommended plugins are django-debug-toolbar (https://github.com/jazzband/django-debug-toolbar) and django-extensions (https://github.com/django-extensions/django-extensions).
Then for Social API logins use https://python-social-auth-docs.readthedocs.io. For Social API's themselves there are python wrappers, like https://github.com/mobolic/facebook-sdk. In the worst case, you'll be querying API's directly with requests (http://docs.python-requests.org).
Next, you begin to build views (and their templates) around the models you've created. You're going to want them to run at a parity with what you have in PHP. Use urls.py regular expressions to match your URL's too.
This is how you mitigate the risk of doing a "migration". And also a great way to get some experience under the belt while you do it. You should be able to get your site working off a staging database in a read-only way when you do this. Keep the PHP site in production until your ready to switch.
If you use JSON/REST, also check out Django REST Framework. http://www.django-rest-framework.org/
I'm going to be making a detailed blog post on django in a few days as well.
[1] https://docs.djangoproject.com/en/1.11/howto/legacy-database...
comment 9y ago · link · parent
That said, I'd like to try to sell you on Python. First off, let's begin by saying PHP is a solid web language with mature tools. I haven't looked at the ecosystem in maybe 5 years. Due to this, I can't speak for PHP 7 and the latest and greatest best practices and libraries.
But as of 2017, I think python has surpassed PHP in web development. This is due to some fundamental things being baked into the language, and external factors like luck, timing, and momentum.
0. PHP's "lost years": PHP didn't capitalize on standardization, packaging and libraries for a long time. I don't know what the reason was, but it was PHP 5 for a long time and the language didn't "move".
This allowed other languages like ruby to gain ground back in 2005-2012. PHP 6 never happened. The community had to pull together and start PHP-FIG and stuff. During those years, a lot happened, other language ecosystems gained significant traction.
Sure, there were great strides in individual projects like Drupal and Wordpress. But these CMS and frameworks lacked a package manager during that time. And despite being OOP, developers weren't sharing each other's code the same way Ruby and Python did.
1. Code standardization: Python nails this. PEP8 (code style), PEP257 (code documentation).
1.1 Code aesthetic: While the lack of subcolons and block-style struck me as a gimmick for a while (remember I did PHP before python), I came to find it makes code a hell of a lot easier to read.
2. Package management - People started publishing packages early on. Even if there was distutils/setuptools warts for a couple years, the practice of having a real market for code was great. PHP didn't have that for a long time.. anyone remember PEAR?
3. OOP: Python's OOP makes it very clear to move up the class tree. This sort of winds in with the the code style too, you can easily navigate and traverse large codebases and wrap your brain around chunks of code really fast in python.
4. Imports: Better implemented in python. Much more straight forward and clear. You can pull in a full module from your environment's current packages or relative location (import flask or import . mymodule). You can also import objects like constants, functions and classes scoped in a module, like "from mymodule import myfunction", also import as an alias, "from mymodule import myfunction as a".
5. Community: At this point, Python's community is more active. Though PHP seems to be strong as well. People are building websites in PHP and are still successful at it. That says a lot.
6. Use Domains: Python is being used in big data (pyspark), general data science with pandas, numpy, juypter. The web with django, flask. System utilities like supervisor. People can write mobile games with kivy. There are C speedups like Cython. ORM's like Peewee and SQLAlchemy are mature and superbly documented.
6.1 Web: Python's most popular web framework, Django, is very mature. The ORM is very nice. Migrations. Documentation. Flask, a popular framework for Python, also have excellent documentation and many users. And aside from that, there are many other web libraries like Pyramid, and ones I can't even think off the top of my head. Pyramid is actually one I hear great stuff about haven't even tried yet.
7. Runtime implementations: CPython (default), pypy (python-hosted), Jython for Java and IronPython for .NET
8. Performance: pypy, numpy/pandas has tabular / typed speedups. I'm probably forgetting a few.
9. C/C++ integration: Boost.Python, pybind11 (new and highly cool), CFFI, Cython, Swig, and the CPython's own implementation of C API's, which CPython itself builds upon is at your disposal, and ctypes.
10. Documentation: Python itself, as well as the top libraries in the open source community all use Sphinx to generate documentation. Builds nice static, themed HTML sites with a nifty feature called "intersphinx" to link across project documentation. And it's used at scale in the community. Big thanks to ReadTheDocs.org for providing a place for the community to host.
In most cases, the above "nice things" about python have been around in production and used at scale long before I did Python full time. This gives python a significant advantage.
Some additional free resources on Python:
comment 9y ago · link · parent
- Django may be "batteries included", but definitely not monolithic. It's your choice how you want to implement views. Nothing's tying you down to using a DetailView, but by conforming to them, you make your code more readable and consistent.
You can also pick your own template system, like Jinja2, but django templates are still fast, intuitive, and powerful. You don't have to pull in every contrib module and CBV. You don't have to use django.forms, but they save a lot of time with form validation. You don't have to use ModelForm (ORM-backed forms), but it gives you the ability to get database-backed form behavior with little work. They're also designed to be customizable for specialized scenarios.
Django is designed from the ground up to let you override and expand. django.forms build upon the "field" API (https://docs.djangoproject.com/en/1.11/ref/forms/fields/), which represents the data sent back and forth. And widgets, the HTML representation (https://docs.djangoproject.com/en/1.11/ref/forms/widgets/). You can use django, and build your own fields and widgets to use with forms.
You don't have to load every template tag and filter library. It's configurable on a per-template (per-file) basis. You don't have to use the auth system, but if you do, you can still use a custom User model and backend (https://docs.djangoproject.com/en/1.11/topics/auth/customizi...).
But you're going to have to conform to some sensible conventions (such as a settings modules, urls.py, request contexts). In most situations, you'll pull in stuff from django.contrib, like django.contrib.auth, and occasionally you'll write your own custom replacements.
And you'll end up using the ORM.
- While it's not SQLAlchemy, Django's ORM is capable. It may not have as many bells and whistles, but Django ORM is not "weaker" in any sense. It's been used in production for 10+ years and works across SQL dialects. In a pinch, one-off custom queries have.raw(), and I could still run those safely thanks to params (https://docs.djangoproject.com/en/1.11/topics/db/sql/#passin...). Also, the migration system is nice.
- While development settings can be slow when you're using asset managers (like django-compressor), Django can scale. Of course if you're rebuilding SASS every refresh and not using cache, you're going to have 500ms to 1 second page loads that can be cringey if you're hauling in bootstrap. But in practice, you're going to be compressing those files in production and using caching settings.
- Testing can be fast. My favorite tool is RequestFactory (https://docs.djangoproject.com/en/1.11/topics/testing/advanc...). I could run about 100+ tests in about 300ms. So every time I saved, I checked the permissions/integrity of all my views, including ones which used the ORM.
comment 9y ago · link · parent
Remote: Preferred
Technologies: Python, C++, Javascript, Postgres/MySQL, Linux/FreeBSD, Salt/Fabric, CMake
Websites / Portfolio: https://www.git-pull.com, https://www.github.com/tony, https://openhub.net/accounts/git-pull
Willing to relocate: Yes
CV: Available upon request
Email: tony at git-pull.com
Solid track record of end-to-end software product development including API design, technical documentation, continuous integration and deployment. My software is used by thousands around the world daily. Leader of multiple open source projects and author of The Tao of tmux.
Available on contractual and consulting basis. Python is my tool of choice. I ship high quality, production-ready code regularly and routinely.
No whiteboarding or take homes, please. My software, including code, documentation, tests, and packages are publicly available on my websites.
comment 9y ago · link · parent
Chicago
VP, Senior and managing roles only. Type A. Open source background with diverse portfolio.
https://openhub.net/accounts/git-pull
CV available open request
Email: tony at git-pull.com
Solid track record of end-to-end software product development including API design, technical documentation, continuous integration and deployment. My software is used by thousands around the world daily. Leader of multiple open source projects and author of The Tao of tmux.
Available on contractual and consulting basis. Python is my tool of choice. I ship high quality, production-ready code regularly and routinely. Also do some C++ and JavaScript.
comment 9y ago · link · parent
https://github.com/kvasdopil/docker
https://github.com/3ofcoins/jetpack
Unfortunately, they haven't been updated in a while. But this is what we mean when we want docker on other hosts. use FreeBSD's native jail and linux subsystems. In other words, "OS-level virtualization" [1]
Rather than treating other platforms like second class citizens and relying on ad-hoc workarounds that require virtualbox, a middleman linux distribution running in the background; not to mention the error-prone networking redirection the aforementioned introduces.
Two points:
1. The whole point of docker is to not have to haul in a linux distribution and a fire up a vm just to deploy something for development or production. If they're using Docker w/ a VM, they're better off just using Vagrant.
2. FreeBSD jails work fantastic. What's keeping docker from abstracting upon that and supporting it officially, especially seeing these two implementations in the wild?
I look forward to seeing more of kvasdopil's docker fork (https://www.freshports.org/sysutils/docker-freebsd/) and jetpack.
[1] https://en.wikipedia.org/wiki/Operating-system-level_virtual...
comment 9y ago · link · parent
When the job market is saturated:
There's a desperate shortage / skill gap of programmers, truckers and pharmacists. Go join this trade school for 16k! The economy is going to hell in a hand basket if we don't churn out 1000 new Javascript programmers every 12 weeks!
When travel agencies want cement their dominance and pour cold water on new competition:
Things are full, really! Don't bother applying Y Combinator as an online travel agency. You're just wasting your time and won't be able to generate any VC or get a single hit to your website! It's futile for... reasons!
comment 9y ago · link · parent
So as part of this, and after years, I eventually realized the only way to make a scalable tool to lookup Han glyphs is to build upon UNIHAN: The Unicode Consortium's Han Unification effort.
I write about Unicode and UNIHAN in my own words here: http://unihan-etl.git-pull.com/en/latest/unihan.html
The challenge with Unicode and hanzi is there are many historical and regional variants to a single source Han grapheme of the same meaning.
So, each glyph or variant gets its own codepoint, or number, reserved. In fact, this years when Unicode 10.0 is cut, the new CJK Extension F will introduce 7,473 characters (http://unicode.org/versions/Unicode10.0.0/).
Thankfully, my only task is to make the database accessible in as friendly a way as possible. Which is actually a mammoth task, see, there are over 90 fields which are used to denote dictionary indices, regional IRG [1] indices (which are national-level workgroups that convene to add new characters), phonetics (mandarin, cantonese jyutping, and more).
The fields are dense. They pack in objects that are most easily split up by regular expressions. https://github.com/cihai/unihan-etl/blob/master/unihan_etl/e...
So a UNIHAN field for kHanyuPinyin (http://www.unicode.org/reports/tr38/#kHanyuPinyin):
U+5364 kHanyuPinyin 10093.130:xī,lǔ 74609.020:lǔ,xī
U+5EFE kHanyuPinyin 10513.110,10514.010,10514.020:gǒng
U+5364 is two values (separated by the space), then a list of items either of the colon (:), which are separated by commas.
You may wonder where this all comes from. The effort is global, but a good deal of it is thanks to people who took their time to contribute it, organizationally or personally. Take a look in the descriptions of the fields at http://www.unicode.org/reports/tr38/ for bibliographic info.
In any event, the hope is to create a successor to cjklib (https://pypi.python.org/pypi/cjklib) and have datasets for CJK available in datapackages (http://frictionlessdata.io/data-packages/). That way, sources of data are sustainable and not tied down to any one library.
[1] https://en.wikipedia.org/wiki/Ideographic_Rapporteur_Group
comment 9y ago · link · parent
And while some report benefits and advancement, I have to tell you, the amount of tools you have to pull in these days just get some single page interaction going... Just stop. And we need to draw a line between "progress" for the language and its libraries vs introducing features without discipline. The more features a language has, the harder it will be for open source and industry to develop consensus on what's idiomatic.
Want to know another language feature? Being stable.
I swear, it's like the language reinvents itself every year. Give me some sort of promise when you'll leave the standard alone, then I'll wait for the community to form best practices / libraries to catch up. After the dust settles, I'll invest time reading up on the standard.
Ain't trying to jab javascript. Love the language, community is top tier, but everything these days from build tools to libraries seems like a moving target.
comment 9y ago · link · parent
And it's been doing the trick for years. Prior to building the tmux workspace, it even can call a bootstrap script (https://github.com/tony/tmuxp/blob/master/bootstrap_env.py) to check for and install dependencies.
When a tmuxp session file (https://github.com/tony/tmuxp/blob/master/.tmuxp.yaml) is loaded, it automatically can source the user into virtualenvs, launch file watchers, and so on.
Saves so much time.
Since most software projects involve the same flow (installing packages locally for the project, launching a test runner.)
Other things that help keeping it cross platform are using Makefile and commands conforming to POSIX (https://github.com/tony/tmuxp/blob/master/Makefile). So when bringing up a list of files for entr (a file watcher http://entrproject.org/) to run commands when files are saved, use posix find arguments only. Use $(MAKE) for recursive calls (https://www.gnu.org/software/make/manual/html_node/Recursion...).
comment 9y ago · link · parent
- pymux (tmux clone): https://github.com/jonathanslenders/pymux/
- pyvim (vim clone): https://github.com/jonathanslenders/pyvim/
Lots of community-driven CLI tools with superb autocompletion:
- ptpython: http://github.com/jonathanslenders/ptpython/
- pgcli: http://pgcli.com/ + mycli: http://mycli.net/
- complete shells: xonsh (http://xon.sh/) + ergonomica (https://ergonomica.github.io/)
comment 9y ago · link · parent
- tmux counts as a TUI UX. it is backed by ncurses (https://en.wikipedia.org/wiki/Ncurses)
- colors: it supports 256 colors, 24bit colors landed in 2.2 (but haven't used it)
- layouts: 1) supports splitting multiple command lines into "panes" which are resizable 2) supports custom layouts and arrangements for panes 3) you can "zoom" in on panes via `C-b z` 4) you can actually run other TUI applications within it
- interaction: 1) tmux also forks itself into a server in the background so you can de/re-attach your workspace 2) you can create and move between collections of panes, what tmux calls "windows" 3) command-based, so configuration via ~/.tmux.conf uses the same language as scripting 4) tmux can be scripted / remote controlled, you can even send-keys and copy the contents of panes
- help: the tmux manual is superb (https://www.freebsd.org/cgi/man.cgi?query=tmux)
Downsides are, I still get glitchy issues when using vim / unicode / colors in tmux panes which are difficult to diagnose. `reset` normally fixes it. It's been this way for years, and I don't want to even begin figuring out what the hell is happening because I'm using too many plugins. Considering starting from scratch. So if you get into tmux/vim/other CLI stuff, the simpler you keep your config, the better off you'll be.
(P.S. I am the author of The Tao of tmux, a book you can read free online)
comment 9y ago · link · parent
Oh really? Staged/Unstaged + Commit + Push to remote+branch. Branches (I suppose you could chuck everything in master), and opt-in or out of tagging.
Maybe users will keep their own remote repositories ("forks")? Even then, it's still pulling in code with the same history that's going to get reconciled via a merge or rebase. Whether it's "forked" to their own repo or in a branch of the "main" repo, it's all the same in the end.
> there's a need for a tool that will automate and enforce git workflows
There's easy, light-weight branching baked right into git.
They scale locally, remotely, and also work with different user's remotes.
You can also merge branches into branches. You can pull --rebase them as well.
> there's a need for a tool that will automate and enforce git workflows.
Beyond branches and remotes?
> I wrote a hacky 'git sync' script at an old company and it achieved what sending a bunch of developers on a course about git did not (it sped up the workflow and cut down on git errors).
Checking out branches and git add/status/diff/commit/push is that time consuming not only would you need to create a shortcut, other devs would opt-in to it?
I use shortcuts for various things in my shell. I have a .gitconfig in my dot-config files (https://github.com/tony/.dot-config). Personal tweaks for coloring and editor settings, a global gitignore. I'm the kind of a guy who picks up shell plugins for fun to try them, but I know that pushing a tool on top of a VCS on colleagues won't go over well.
What did `git sync` do?