{"id":31030005,"url":"https://github.com/yusing/aliases","last_synced_at":"2026-02-16T19:09:40.007Z","repository":{"id":199281900,"uuid":"702537539","full_name":"yusing/aliases","owner":"yusing","description":"Zsh/Bash aliases/function aliases that is useful for Docker","archived":false,"fork":false,"pushed_at":"2023-10-09T14:06:43.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-02T03:53:05.688Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yusing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-09T14:01:51.000Z","updated_at":"2023-10-09T14:01:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"148e09a4-2928-4ae4-b01c-ac2873dfd611","html_url":"https://github.com/yusing/aliases","commit_stats":null,"previous_names":["yusing/aliases"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yusing/aliases","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusing%2Faliases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusing%2Faliases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusing%2Faliases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusing%2Faliases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yusing","download_url":"https://codeload.github.com/yusing/aliases/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusing%2Faliases/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275038256,"owners_count":25394640,"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-09-13T02:00:10.085Z","response_time":70,"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-09-13T22:57:26.441Z","updated_at":"2026-02-16T19:09:34.956Z","avatar_url":"https://github.com/yusing.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# aliases\nZsh/Bash aliases/function aliases that is useful for Docker. Simply add these to $HOME/.zprofile.\n\n## Alias List (See descriptions below):\n### Highlighted ones are extremely recommended\n- zshrc\n- zprofile\n- **treedir**\n- **dcedit**\n- dcdown\n- **dcup**\n- **dclogs**\n- dcrestart\n- dcupgrade\n- dbuild\n- dlogs\n- **free_ports**\n```bash\nalias homelab-cfg='sudo nano /etc/nginx/sites-available/homelab \u0026\u0026 sudo nginx -t \u0026\u0026 sudo systemctl restart nginx'\n# edit and save .zshrc\nzshrc() {\n  nano $HOME/.zshrc\n  source $HOME/.zshrc\n}\n# edit and save .zprofile\nzprofile() {\n  nano $HOME/.zprofile\n  source $HOME/.zprofile\n}\n# treedir \u003cdir\u003e\n# list total size of all sub-directories under \u003cdir\u003e\nfunction treedir {\n  sudo du -sh $1/* | sort -hr;\n}\n\nDOCKER_COMPOSE_FILES=('compose.yml' 'compose.yaml' 'docker-compose.yml' 'docker-compose.yaml')\n# dcedit (under stack directory)\n# create default .gitignore if not exists\n# find existing compose yaml file\n# nano compose.yml if not exists\n# call `dcup` if file content was edited\nfunction dcedit {\n  if [ ! -f '.gitignore' ]; then\n    echo -e '*\\n!compose.yml' \u003e .gitignore\n    echo added .gitignore\n    cat .gitignore\n  fi\n  found=0\n  for file in ${DOCKER_COMPOSE_FILES[@]};\n  do\n    if [ -f $file ]; then\n      found=1\n      break\n    fi\n  done\n  if [[ $found == 0 ]]; then\n    echo 'Creating compose.yml'\n    unset file\n    file='compose.yml'\n    touch $file\n  fi\n  oldtime=`stat -c %Y \"$file\"`\n  nano $file\n  # if file changed\n  if [[ `stat -c %Y \"$file\"` -gt $oldtime ]]; then\n\tdocker compose up -d --remove-orphans\n  else\n    echo file unchanged\n  fi\n}\n# dcdown (under stack directory)\nalias dcdown='docker compose down --remove-orphans'\n# dcup (under stack directory)\nalias dcup='docker compose up -d --remove-orphans'\n# dclogs (under stack directory)\nalias dclogs='docker compose logs -f --tail 10'\n# dcrestart (under stack directory)\nalias dcrestart='dcdown -t 1 \u0026\u0026 dcup'\n# dbuild (under Dockerfile directory, uses the folder name as image name)\nalias dbuild='docker build . -t $(basename $PWD)'\n# dcupgrade (under stack directory)\ndcupgrade() {\n    docker compose pull\n    docker compose up -d\n}\n# dlogs \u003ccontainer_name\u003e\nalias dlogs='docker logs -f --tail 10'\n# free_ports \u003cstarting_port\u003e \u003climit\u003e\nfree_ports() {\n    echo \"\nimport socket\nmax=$2\ncount=0\nfor p in range($1, 65535):\n    if count \u003e= max:\n        break\n    try:\n        s=socket.socket()\n        s.bind(('', p))\n        s.close()\n        print(p)\n        count+=1\n    except:\n        pass\n\" | python3\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyusing%2Faliases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyusing%2Faliases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyusing%2Faliases/lists"}