Posts

git rebase interactive command

When rebasing commit history via git rebase -i we can use the following command. Example use-case # In the todo list: edit abc1234 Fix typo Here are the most useful commands for removing or modifying commits : When you run git rebase -i , Git opens a todo list where each commit is prefixed with a command. These are the commands you can use (aliases in parentheses): Command Alias What it does pick p Apply the commit as-is (default) reword r Apply commit, but pause to edit only the commit message edit e Apply commit, then pause so you can change files and run git commit --amend squash s Combine this commit into the one above it & merge both commit messages fixup f Combine this commit into the one above it & discard this commit's message drop d Delete the commit entirely break b Pause the rebase here (useful for manual testing before continuing) exec x Run a shell command at this point in the history label / reset / merge l / t / m Advanced commands for complex rebases ...

git hitting an error :- error: cannot delete branch 'main' used by worktree at 'C:/work/python/langchain-tool'

While trying to delete my main branch i ran into this error. There are many possible solution. One of them could be this cd "C:/work/python/langchain-tool" git worktree list # see the work tree  git switch master   # or any other branch Then try to remove it git branch -d main     

claude APIs - that helps you customize interaction with your clients

  https://platform.claude.com/docs/en/api/overview#client-sdks https://www.anthropic.com/learn/build-with-claude?use_case=ea

android error Activity class {com.appcoreopc.getmyhome/com.appcoreopc.getmyhome.SplashActivity} does not exist

Image
Ran into this issue trying to work out what is the issue causing this. Validated that the activity and package name exsit. Checked android manifest to ensure it is correclty configured.  And the resolution is File -> Invalidate Caches and then re-run your app. That's it! 

Azure flexible federated identity using app registrations to assist with wildcard branch setup

Image
It is a common frustration because we need to federate our app registration credential everytime we are trying to create a branch and do a build. Now we have Azure Flexible federated credential enabled for only App Registrations.   Let's say you an existing app registration we can federate it easily using the following command:-  az rest --method post --url https://graph.microsoft.com/beta/applications/your-app-registration-client-id/federatedIdentityCredentials --body "{'name': 'FlexFic1', 'issuer': 'https://token.actions.githubusercontent.com', 'audiences': [ 'api://AzureADTokenExchange' ] ,'claimsMatchingExpression': {'value': 'claims[\'sub\'] matches \'  repo:kepungnzai/dot-net-gw:ref:refs/heads/*\'','languageVersion': 1}}"  This will create the necessary federated credentials as shown here:-  And in your pipeline    name : ' Login to Azure '         uses : azure/...

Azure managed identity using to authenticate in github worflow actions

Image
We can federate our managed identity in a more flexible manner especially when we need to use it against github and allows our build against different branch without 20 federated credential limits.  Here is an example of how we can federate our managed identity   az identity federated-credential create  --name "github-actions-main"  --identity-name %IDENTITY_NAME%  --resource-group %RG_NAME% --issuer "https://token.actions.githubusercontent.com"   --subject "claims['sub'] matches 'repo:%REPO%:ref:refs/heads/*'"  --audience "api://AzureADTokenExchange" Validating that against our Azure portal, we can get more information here However trying to run this in github, I am still not able to get it to run successfully. That's for a good reason.  The reason I am getting the AADSTS700213 error is because User-Assigned Managed Identities do not yet support wildcard matching for OIDC subjects. Azure recently introduced "Flexible fe...

Flexible federated identity credentials (preview)

  Flexible federated identity credentials (preview) https://learn.microsoft.com/en-us/entra/workload-id/workload-identities-flexible-federated-identity-credentials?tabs=github

Error: Please make sure to give write permissions to id-token in the workflow. Error: Login failed with Error: Error message: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.

Bump into this error here  Error: Please make sure to give write permissions to id-token in the workflow. Error: Login failed with Error: Error message: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.  ` And the fix is adding back id-token jobs :   build-and-deploy :     runs-on : ubuntu-latest     permissions :       id-token : write

github quick and dirty way to setup managed identity and federate github repo

This is a quick an dirty way to setup managed identiy and federation github repo   SET RESOURCE_GROUP="github-rg" SET RG_NAME="github-rg" SET LOCATION="australiaeast" SET IDENTITY_NAME="github-aue-dev-mi" SET SUBSCRIPTION_ID=subscription-id SET REPO="kepungnzai/dot-net-gw" set IDENTITY_PRINCIPAL_ID=acf61232-246e-4782-9234-919307693969 And to federate it  az identity federated-credential create  --name "github-actions-main"  --identity-name %IDENTITY_NAME%   --resource-group %RG_NAME% --issuer "https://token.actions.githubusercontent.com"   --subject "repo:%REPO%:ref:refs/heads/*" --audience "api://AzureADTokenExchange"

github docker image push denied: permission_denied: write_package

 Getting github error message and this reall "shed" light into the error :D denied: permission_denied: write_package Then i notice the build pipeline using this docker image and hence the error.   #18 naming to ghcr.io/kepungnzai/dot-net-gw:dac4bad done So github is actually expecting ghrc + user name + repository name + your image name  Example of pipeline  name : Build and Deploy Azure Function on :   push :     branches :       - main   workflow_dispatch : env :   AZURE_FUNCTIONAPP_NAME : ' your-function-app-name '   # set this to your function app name on Azure   CONTAINER_REGISTRY : ghcr.io   IMAGE_NAME : ${{ github.repository }}/dotnetgw jobs :   build-and-deploy :     runs-on : ubuntu-latest     permissions :       contents : read       packages : write     steps :       - name : ' Checkout GitHub Action ' ...

Android integrating biometric into your app

Let's say we would like to make a payment and to add abit of security to this, we will trigger a biometric to ensure a legit user is authorizing a payment.  To start implementing,  app/build.gradle.kts dependencies { implementation ( libs . androidx . biometric ) And then we will update our MainActivity.kt with this before passing it to our Composable. This onAuthenticate is being passed down all the way to our composable and finally to our button click command  @dagger.hilt.android.AndroidEntryPoint class MainActivity : FragmentActivity() { private val viewModel : HomeViewModel by viewModels () private lateinit var biometricHelper : BiometricHelper override fun onCreate ( savedInstanceState : Bundle ?) { super .onCreate( savedInstanceState ) enableEdgeToEdge () biometricHelper = BiometricHelper( this ) setContent { GetMyHomeTheme { GetMyHomeApp ( viewModel = viewModel , ...