Monday, September 12, 2022

Creating tag from github web UI

 Problem: I have Github Actions that automatically create a new release when certain tag is pushed. The only way to create tag from github web interface is to create a new release. The Actions[1] I'm using however failed with error message:-

Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}

If the tag was created from release.

We can create the tag using another Actions, there are a number of Actions that provide that. First I try using Github Script:-

name: "create-tag"

on:
  workflow_dispatch:
    inputs:
      tagname:
        description: 'Enter tag'
        required: true
        type: string
    
jobs:
  create_tag:
    name: "Create tag"
    runs-on: "ubuntu-latest"
    steps:
      - name: Create tag ${{ inputs.tagname }}
        uses: actions/github-script@v5
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/${{ inputs.tagname }}',
              sha: context.sha
            })

For some reason that doesn't trigger push event though. So I try rickstaa/action-create-tag@v1 but also it didn't trigger push event. This second event is just using plain `git push ...` to push the tag instead of using the REST API, so it's weird that it doesn't trigger the push event.


[1]: marvinpinto/action-automatic-releases@latest

Wednesday, August 31, 2022

Google Family Link Android Device isn't ready

 When setting up Family Link for my kid, the setup keep failing and just showing very unhelpful error message "Something went wrong ..". Since the phone doesn't has family link installed yet, I try to login with my account first and installed Family Link app.

Opening the app, on my kid's account status, I can see it shows "Device isn't ready for ...". I removed my account (since family link account can't share device) and try to add my kid's account again. This time the setup went through!

So if you're facing similar issue and doesn't has Family Link app installed on the device yet, try to install the app with your own account first, before setting up your kid's account.

Tuesday, August 9, 2022

VS Code editor in browser

 There are 2 options, basically:-

  • code-server
  • OpenVSCode

What's the difference? Excerpt from code-server's FAQ:-

code-server and OpenVSCode-Server both allow you to access VS Code via a browser. The two projects also use their own forks of VS Code to leverage modern VS Code APIs and stay up to date with the upsteam version.

However, OpenVSCode-Server is scoped at only making VS Code available in the web browser. code-server includes some other features:

  • password auth
  • proxy web ports
  • certificate support
  • plugin API
  • settings sync (coming soon)

 So I decided to try code-server. Installation is straightforward, as copied from the docs page:-

curl -fsSL https://code-server.dev/install.sh | sh

After that you can run it as:-

PORT=3000 code-server

To actually access that from my laptop, I just use ssh port forwarding:-

ssh -L 3000:localhost:3000 my-server

I can then access it through my browser at https://localhost:3000/. You'll need to copy password from ~/.config/code-server/config.yaml.

So far the experience is satisfying. It feels the same as in Github Codespaces.

Wednesday, March 28, 2018

PHP with docker

A friend asking about a PHP library and I decided to test whether that library is working. But I don't have PHP environment setup (we're Python shop btw). But thanks to docker, that's easy these days.

docker run -it --tty --rm --volume $PWD:/app --user $(id -u):$(id -g) composer require google/apiclient:^2.0

Then we just need to create the script to run, still in the same directory:-

include_once __DIR__ . '/vendor/autoload.php';

$GCSE_API_KEY = "nqwkoigrhe893utnih_gibberish_q2ihrgu9qjnr";
$GCSE_SEARCH_ENGINE_ID = "937592689593725455:msi299dkne4de";

$client = new Google_Client();
$client->setApplicationName("My_App");
$client->setDeveloperKey($GCSE_API_KEY);
$service = new Google_Service_Customsearch($client);
$optParams = array("cx"=>self::GCSE_SEARCH_ENGINE_ID);    
$results = $service->cse->listCse("lol cats", $optParams);

And we can run that script again using docker:-

docker run -it --rm --volume $PWD:/app -w /app php:5.5-cli php cse.php

Links:-

https://stackoverflow.com/questions/41592249/how-to-use-php-client-for-google-custom-search-engine
https://hub.docker.com/r/library/php/
https://hub.docker.com/r/library/composer/

Tuesday, March 13, 2018

Receiving Email Using SES

There's service like Pawnmail (seem to be down now) that allow you to receive email on your custom domain. But that's a third party and mean adding another one into your trust list.

Since we already using AWS, I'm wondering if it has anything that can receive email. They have SES that usually used to send email. But turn out SES can also receive email. So just add the MX record in your DNS to inbound-smtp.us-east-1.amazonaws.com.

Next is to configure the domain and address to receive the email.


The received email need to be forwarded somewhere like to your application for processing but that's overkill. I need something simpler. Here come SNS, Simple Notification Service. So the email can be forwarded to an SNS Topic. From the SNS Topic you can create Subscription that will forward the email to your actual email, finally.


SNS will send the email as JSON so if you received HTML email that will be appear in your inbox as is. But since I can read HTML, that should be fine.


Friday, November 10, 2017

The rise of localhost

I noticed a pattern in dex world, where you build client backend to participate in the network, and then build a web app that simply connect to localhost:someport for the UI.

To check my scuttlebutt updates, I opened up http://localhost:8027/. For those using Ethereum Parity wallet, they can open it at http://localhost:8180/. ZeroNet users are browsing at http://localhost:43110/.

But Parity for example, try to make it seamless, they still provide a dns - web3.site which then redirected to home.web3.site which simply resolved to 127.0.0.1. But this I think bring up some problem, especially non-tech user which think that Parity is a website hosted by Parity Technologies. I seen this in a some articles about the latest bug.

Wednesday, October 11, 2017

The first step in learning new programming language

Is to prepare the basic environment where you can freely try and experiment with the new language features and tools. Maybe because I'm not programmer type person, but more as tinkerer/builder, I hate learning the language syntax and stuff.

For years after I started "learning" Python, I can't barely write any Python code. But I have manage to try lot of Python cool apps because I have that environment for me to experiment with all Python based applications. All these cool apps that get me hooked to the language, not the syntax or whatever language features. And in my experiences, this is one reason why people failed to get hooked on the new language they want to learn. They started learning with some of the language syntax and eventually get bored, because not so much interesting stuff there. In whatever programming language, it's the ecosystem that made it lively, and where the real work happened.



Early this year, I made it a point to learn Go programming language. It's almost a year now and similar to my Python experience I mentioned above, I can't barely write any Go code. But I have an environment where I can try a lot of Go based applications, and this is the reason I'm still hooked to the language even I haven't manage to write my own code yet. Back with Python experience, I'd only manage to know Python and write Python code after I got my first Python job. That was years after I started learning the language.

The reason this work I think similar to when learning human language. To master the language, you need to practice it. And to practice the language, you need to be in an environment where the language being used. That's it, the environment. So instead of trying to understand the for loop or the class syntax, I spent time to understand how packaging and deployment work, so I can actually run the application for other people to make use of it.

So start to invest your time in having the environment first, whenever you want to learn any new programming language.