{"id":35093812,"url":"https://github.com/mhered/useful","last_synced_at":"2026-04-09T10:02:53.563Z","repository":{"id":202894156,"uuid":"708370216","full_name":"mhered/useful","owner":"mhered","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-22T21:24:17.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T22:26:46.920Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mhered.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-22T11:13:16.000Z","updated_at":"2025-06-22T21:24:20.000Z","dependencies_parsed_at":"2024-11-12T00:22:44.884Z","dependency_job_id":"97da002f-31ec-4d0c-8bb4-841af1e9bd07","html_url":"https://github.com/mhered/useful","commit_stats":null,"previous_names":["mhered/useful"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mhered/useful","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhered%2Fuseful","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhered%2Fuseful/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhered%2Fuseful/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhered%2Fuseful/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhered","download_url":"https://codeload.github.com/mhered/useful/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhered%2Fuseful/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28080200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-27T15:03:08.557Z","updated_at":"2025-12-27T15:04:27.179Z","avatar_url":"https://github.com/mhered.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# useful\n1. [Recover after Windows corrupts dual boot](#recover-after-windows-corrupts-dual-boot)\n   \n2. [Download video with subtitles to watch offline](#download-video-with-subtitles-to-watch-offline)\n   \n4. [Setup git in new computer](#setup-git-in-new-computer)\n   \n4. [Open SLDPRT CAD without SolidWorks](#open-sldprt-cad-without-solidworks)\n   \n5. [Embed video in Markdown](#embed-video-in-markdown)\n\n5. [Recover large messy change in code](#recover-large-messy-change-in-code)\n\n\n## Recover after Windows corrupts dual boot\n\n### Problem\nFor no apparent reason dual boot stops working.\n- the following message flashes briefly during reboot:\n\n```bash\nFailed to open \\EFI\\ubuntu\\grubx64.efi - Not Found  \nFailed to load image: Not Found    \nstart_image() returned Not Found, falling back to default loader\nFailed to open \\EFI\\ubuntu\\grubx64.efi - Not Found  \nFailed to load image: Not Found    \nstart_image() returned Not Found\n```\n- the grub menu that allows choosing OS is skipped, and instead Windows boots directly.\n\n### Fix 1\n\nInstructions based on: https://askubuntu.com/a/1134107\n\n1. power down \n\n2. plug a live USB of Ubuntu 20.04 \n\n3. Power up the laptop, access UEFI (in LG gram: press F2 during 3 secs)\n\n4. Ensure USB is first in boot order\n\n5. Select \"Try Ubuntu\" this will boot Ubuntu from USB\n\n6. Configure Wifi to have internet connection.\n\n7. Open a terminal and type:\n\n```bash\n$ sudo add-apt-repository ppa:yannubuntu/boot-repair \u0026\u0026 sudo apt update\n$ sudo apt-get install boot-repair \u0026\u0026 boot-repair\n```\n\n8. Select \"Recommended fix\". This will fix grub and reinstall it and create a boot info log in a logbin.\nThe app provides a report in a pastebin to send to boot.repair@gmail.com if further troubleshooting is needed\n\n10. Reboot\n\n### Fix 2\n\nMay need to disable fast boot and early threat checks for above to work\n\nThere are 4 ways to enable/disable fast boot, see:  https://www.youtube.com/watch?v=M3nbEqSBs04\n\n1) control panel \u003e hardware and sound \u003e power options \u003e behaviour closing lid\u003e change settings unavailable \u003e untick fast startup\n\n2. terminal \u003e right-click\u003erun as admin \u003e \n\n```shell\n\u003e powercfg /h off\n```\n3 disable in group policy editor \nbut, need to install `gpedit` first, didn't succeed \ncreate a file `gpedit-install.bat`:\n```\nFOR %F IN (\"%SystemRoot%\\servicing\\Packages\\Microsoft-Windows-GroupPolicy-ClientTools-Package~*.mum\") DO (DISM /Online /NoRestart /Add-Package:\"%F\")\nFOR %F IN (\"%SystemRoot%\\servicing\\Packages\\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~*.mum\") DO (DISM /Online /NoRestart /Add-Package:\"%F\")\n```\nexecute it as admin\n```\n\u003e gpedit.msc\n```\n\n### Fix 3\n\nIf previous ones do not work, try manually\nSource: https://askubuntu.com/questions/88384/how-can-i-repair-grub-how-to-get-ubuntu-back-after-installing-windows/88432\n(CHECK SOURCE THIS IS NOT COMPLETE)\n\n```\nsudo fdisk -l # 1. Determine the partition number of your main partition and EFI\nsudo mount /dev/nvme0n1p7 /mnt  # 2. mount the main Linux sistem\nfor i in /sys /proc /run /dev; do sudo mount --rbind \"$i\" \"/mnt$i\"; done # 3. some needed bindings (?)\nsudo mount /dev/nvme0n1p1 /mnt/boot/efi # 4. mount EFI\nsudo chroot /mnt # 5. update grub\nupdate-grub\ngrub-install /dev/sda # 6. just, in case reinstall grub\nupdate-grub\nexit\nreboot\n```\n## Download video with subtitles to watch offline\n\n### Problem\nYou are boarding a plane and need to quickly download a video to finish watching it during the flight. And you want subtitles.\n\n### Fix\n\n1. If needed, install `yt-dlp`\n\n```bash\n$ sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp\n$ sudo chmod a+rx /usr/local/bin/yt-dlp  # Make executable\n```\n2. Type in terminal the command below replacing the video code e.g. `uf4zOigzTFo`. This downloads video and subtitles as 2 separate files e.g. `.vtt` and `.webp` to the current folder.\n\n```bash\n$ yt-dlp --write-sub --write-auto-sub --sub-lang \"en.*\" https://www.youtube.com/watch?v=uf4zOigzTFo\n```\n\n3. Play the video in VLC. In Subtitles select the appropriate `vtt` file. Note for some reason subtitles work in VLC but not in the default ubuntu player\n\n## Setup git in new computer\n\n### Problem \nYou try to git push and git asks for user/pwd, \n\n### Fix\n\n1. go to github, [create a Personal Access Token PAT (classic)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic)\n\n2. Add your user info, set up credential manager to store the PAT next time:\n```bash\n$ git config --global user.email \"my email\"\n$ git config --global user.name \"my name\"\n$ git config --global credential.helper store # to store PAT in the credential manager\n```\n3. Next time you try to push, git requests username/PAT one last time and the credential manager stores it:\n```bash\n$ git push\nUsername for 'https://github.com': # enter your username\nPassword for 'https://mhered@github.com': # enter your PAT\n```\n\n## Open SLDPRT CAD without SolidWorks\n\n### Problem\nmany CAD files available for download are in SLDPRT format and SolidWorks requires suscription\n\n### Fix\n* Create account in [OnShape](https://cad.onshape.com/) (with spam user), open file then export as STL or STEP\n* [AnyConv](https://anyconv.com/) but rather unreliable: scale not respected, or failure to convert \n* [ConvertCADFiles](https://convertcadfiles.com/): one free trial, afterwards pay per conversion\n* Not tested: [download eDrawing](https://www.solidworks.com/support/free-downloads) (for Windows)\n\n## Embed video in Markdown\n\n### Problem\nMarkdown does not display mp4 and converting directly to gif yields huge files\n\n### Fix\n1. record live video with iphone (optionally edit it in the phone using imovie) / save desktop screencast with kazaam to mp4 \n2. edit mp4 in shotcut: cut to length, speed up?, select loop, export as gif animation\n3. upload gif to https://www.iloveimg.com/, resize by percentage 75% smaller\n\n## Recover large messy change in code\n\n### Problem\nYou made too many changes in your code without commiting, it does not work and you cannot debug. You want to go back and reapply changes step by step\n\n### Fix\n\n```bash\n# 1. stash staged, unstaged and also untracked files (ignored files are not stashed)\ngit stash push -u -m \"Full backup before debugging\"\n\n# 2. go back to last safe commit (optional)\ngit reset --hard HEAD\n\n# 3. create a patch file (optional, for safety)\ngit stash show -p stash@{0} \u003e changes.patch\n\n# 4. Create a new branch to work on\ngit checkout -b fix-mess\n\n# 5. Apply the full patch (it becomes unstaged changes)\ngit stash apply stash@{0}\n\n# 6. Use Git's interactive staging to pick parts\ngit add -p\n# Options: y = stage this hunk, n = skip, q = quit,\n# a = stage all, d = skip all,\n# s = split hunk, e = edit manually, ? = help\n\ngit commit -m \"First clean chunk of change\"\n\ngit stash push -u -m \"Tmp testing first chunk\" # put aside uncomitted changes\n# \u003crun tests\u003e, when succesful -\u003e\ngit stash pop # apply and drop the temporary stash to resume adding changes\n\n# Repeat until all desired changes are committed\n\n# Abort if needed\ngit reset --hard\n\n# when done: drop stash\ngit stash drop stash@{0}\n\n# then merge the branch and delete it\ngit checkout main\ngit merge fix-mess\ngit branch -d fix-mess\n\n\n```\n\n\n\n| Step             | Command                               |\n| ---------------- | ------------------------------------- |\n| Apply full patch | `git apply changes.patch`             |\n| Stage part of it | `git add -p`                          |\n| Commit           | `git commit -m \"...\"`                 |\n| Repeat           | `git add -p`, then `git commit` again |\n| Abort if needed  | `git reset --hard`                    |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhered%2Fuseful","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhered%2Fuseful","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhered%2Fuseful/lists"}