How to run gcloud on Chromebook

Ok – my new best friend is Chromebrew – a lightweight package manager that lets you run linux programs in Chromebook developer mode without having to install a whole operating system. 

I needed it because (a) I develop and deploy code from my chromebook using github and Google’s Cloudshell virtual linux machine and (b) lately, Cloudshell has not been reliably available.

Here is what I needed to learn and do:

  1. Get my chromebook into developer mode, which on my machine (Acer C740) requires holding esc-Refresh and hitting the power key. That gets you to the Recovery Screen. Hit Ctrl-D (there’s no prompt). It will ask you to confirm, then reboot into dev-mode. Eventually it will show the scary boot screen and you just hit Ctrl-D again.
  2. Enter crosh (the terminal) with Ctrl-Alt-T and type shell.
  3. Learn how to copy and paste – inside crosh you use Ctrl-Shift-C and V instead of just Ctrl-C and V.
  4. Install chromebrew via curl -Ls git.io/vddgY | bash
  5. Install gcloud via: > crew install google_cloud_sdk
  6. > gcloud install
  7. > gcloud components update
  8. Next I had to figure out where I could put my source code for my project. The only folders you can write in are either /usr/local and ~/Download. The latter has a huge advantage because the caret editor already installed will work in that area. I tried >crew install nano but nano was very “jumpy” running in the shell tab.
  9. I also loaded two nice Chrome extensions from the webstore – Secure Shell and an app that launches your crosh shell in a window.
  10. > cd ~/Download
  11. > git clone https://github.com/youraccount/yourproject.git – which puts it in the folder ~/Download/yourproject
  12. Now if you try “gcloud deploy” it won’t work. You have to do
  13. cd yourproject
  14. > gcloud beta deploy ./app.yaml –project=yourproject –version=1
  15. The first time you run it it will load additional stuff into gcloud but not thereafter.
  16. Just for fun, I also tried >crew install php and chose the latest version. This is really handy because php includes its own webserver – you can do >php -S localhost:8000 which you can use to test your app from your chrome browser.  It includes sqlite which – if you code using pdo – you can even try out things you will later run in mysql.

 

PHP GAE and the GSuite Directory

UNDER CONSTRUCTION AS I GO…

My latest adventure has been trying to create a staff directory for my organization’s GSuite user directory. There are commercial versions available, but all are both expensive and don’t do what I need.

This dives me into the somewhat complex world of OAuth authentication and the google API.

There is a php googleapi client, but it consists of 7600 files which seems a bit fat for just issuing a few curl commands.

Authentication to GSuite is described here. Basically, as far as I can tell:

  1. I need to create a service account for my app with it’s credentials. I’ve read in some places that for a GAE you don’t need to tell the app where this is, as it finds it in the standard environment.
  2. I need to give domain-wide delegation to the service account in the GSuite admin.

This is different than I’ve seen in other documents, which uses a delegated admin email.

 

Pure CSS Tips and Tricks

[Under Construction]

I have recently decided to move our code base from Bootstrap 3 to Pure CSS. Pure is a very light-weight CSS framework that does not depend on JavaScript and so has advantages for areas with poor bandwidth. I am new to it, so this is what I’ve learned.

  1. Not ready out of the box. While the basic pair of css files will give you access to both non-responsive and responsive grids and drop=down menus and other components, quite a few basics are missing. (If I were King, I would propose a law that you the websites for css frameworks should not use added css!) You will need to add your own css file. One of my objectives is to have that be as small and straight forward as possible.
  2. Padding. Out of the box Pure assumes zero padding on its divs – which makes them quite ugly for holding text, and if you add padding you break the columns, and the solution is a bit arcane. In their own extra css file

PHP Coding in the Cloud for Google App Engine

I love my Chromebook, and the whole idea of cloud computing. It’s great to have a single-login to GSuite (formerly Google Apps), and custom web-apps that easily integrate. But coding on my Chromebook has been — well — awkward. There are a number of Cloud-based IDEs (Cloud9, Codenvy), but none that really integrate well with Google App Engine.

One would think Google would provide great web-based tools. Maybe, probably, someday. But meanwhile – here is one way how to do it with the “basics” — GitHub (or other git repository) — and Google’s Cloud Shell.

    1. Create a Google App Engine Project (GAE).  You’ll need a unique name – like zork23 – it will wind up as zork23.appspot.com.
    2. Create a zork23 project on GitHub under youraccount on github, and you can edit the code right there on GitHub.
    3. Log into your Google Cloud Console and click on the Cloud Shell icon at right.

    shell

    1. You are now at a terminal of your very own virtual linux computer, with git and the gcloud tools installed. You can use git to manage a local copy of your app, and then use gcloud to deploy. A quick-start example of doing so with a python app is here.
    2. I had never used git from the command line before. To get your app, you clone it into your virtual computer computer:
      >cd ~/src
      >git clone https://youraccount@github.com/youraccount/zork23.git
    3. If you’ve worked with Google App Engine before, you’ve probably deployed using a tool called appcfg.py which references a special configuration file called app.yaml. gcloud has a few different requirements – you cannot specify the application name or the version in the app.yaml file. Instead you do:
      > cd ~/src/zork23
      > gcloud app deploy  ./app.yaml  –project=zork23  –version=1
    4. Then — you can jump back and forth between editing in github, and using the uparrow to keep running shell commands for updating:
      > git pull https://youraccount@github.com/youraccount/zork23.git
      > gcloud app deploy ./app.yaml –project=zork23 –version=1

    It really should not have to be this way, of course – both github and google could just have a nice little button that does this. But, in the meantime, this works smoothly for me.

Strategic Solutions

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

Knowledge is Power

Learn. Know. Share.
This section of the website is designed to empower you with materials and tools to learn more about hunger and all of the interconnected issues which play a critical role in our ending world hunger once and for all. Please see the issues pages for more facts on each topic as well as information about what The Hunger Project does. Below are downloads for everything from one-page information sheets to videos and printable infographics.

Know your world: Quick facts about hunger and poverty

Empowering Women

Our Approach

Our programs in 17,000 communities throughout Africa, South Asia and Latin America are based on an innovative, holistic approach, which empowers women and men living in rural villages to become the agents of their own development and make sustainable progress in overcoming hunger and poverty.

holistic-approach

While adapted to meet local challenges and opportunities wherever we work, all our programs have at their foundation these three essential elements:

  1. Empowering women as key change agents
  2. Mobilizing communities for self-reliant action
  3. Fostering effective partnerships with local government

One of our first activities is a Vision, Commitment and Action Workshop, which serves as the foundation of our work, inspiring individuals to move from “I can’t” to “I can” to “We can.” Through participation in our trainings, people set a vision for their communities, and then lay out the actions they will take to achieve that vision. Read more about this workshop.

Our Strategies

In eight countries in Africa, The Hunger Project’s Epicenter Strategy mobilizes clusters of rural villages into “epicenters,” which band together 5,000-15,000 people to carry out community-led integrated strategies to meet basic needs. Women and men in 121 epicenters create and run their own development programs, reaching 1.6 million people in their communities.

In India, The Hunger Project empowers women elected to local government in more than 2,500 panchayats (clusters of rural villages) to meet the development needs of their communities. Across seven states of India, these women lead 12 million people. At the regional level, we facilitate federations of women leaders to strengthen their voice and provide a platform for learning and exchange.

In Bangladesh, The Hunger Project mobilizes local “animators,” (trained volunteers), youth, women leaders, and local government representatives. In 2013, efforts intensified in 112 priority“MDG Unions” (clusters of rural villages) to carry out holistic, bottom-up strategies to achieve the Millennium Development Goals in their communities. Their work reaches 4.6 million people.

In Mexico and Peru, we support community development initiatives, focusing on the people who are the most marginalized, particularly indigenous women, reaching 21,000 people. Our work includes a special focus on improving childhood and maternal malnutrition and igniting local entrepreneurship.

COMMUNITIES

throughout Africa, South Asia and Latin America are taking charge of their own development and creating vibrant local economies where citizens, government officials and community-based organizations work in effective partnership.

VOLUNTEER LEADERS

around the world are mobilizing millions of others to take self-reliant actions. They initiate projects such as campaigns against early

Rethink World Hunger

The Hunger Project started in 1977 with a bold new vision: the end of hunger was achievable and could become our reality. At that time, 30,000 children were dying each day due to hunger. Now, that estimate has been reduced by more than 70%. That means that today — and each day — 21,000 fewer children are dying from hunger-related causes. It is time to rethink world hunger.

The end of world hunger is not only possible. It is now within reach.

The global community is joining together to eradicate hunger by the year 2030. And each of us has a pivotal role to play.

Over the last 25 years, The Hunger Project has pioneered strategies that work. We have discovered that communities can sustainably end their own hunger when they:

  • Start with women
  • Mobilize everyone
  • Engage government

Created as a strategic organization, The Hunger Project challenges itself to remain on the cutting edge, reinventing ourselves time and again to take on each opportunity along the journey of ending hunger.

We cannot reach our goal with business as usual. It will take innovation, commitment and partnership. We must use the lessons we have learned to transform the way the world carries out its work to end hunger.

Your participation has never been more critical. We invite you to bring others into the movement at this exciting time so that, together, our human family can end hunger once and for all.