2024-06-21
Migrate Conda Installation Folder

To copy the entire Conda user data directory to another disk and then create a symbolic link back to the original place, you can follow these steps:

Identify the Conda user data directory: This is typically located at ~/.conda or ~/miniconda3 or ~/anaconda3, depending on how you installed Conda. You can find the exact path by running conda info --envs and looking for the envs dirs entry.

Copy the directory to the new location: Use rsync to copy the directory, as it will preserve the file permissions and symbolic links. Here’s an example command:

1
2
rsync -avh --progress ~/.conda /path/to/new/location/conda_data_backup

Replace /path/to/new/location/conda_data_backup with the actual path where you want to copy the directory on the other disk.

Create a symbolic link: Once the copy is complete, you can create a symbolic link from the original location to the new one. First, you may need to remove the original directory or move it to a different name. Here’s how you can do it:

1
2
3
mv ~/.conda ~/.conda_old  # Rename the original directory
ln -s /path/to/new/location/conda_data_backup ~/.conda # Create the symlink

Make sure to replace ~/.conda with the actual path to your Conda user data directory and /path/to/new/location/conda_data_backup with the path to the copied directory on the new disk.

Test the setup: Before deleting the old directory, test your new setup to ensure everything is working correctly. Activate your Conda environments and run some commands to verify that packages are accessible and that you can install new ones.

Clean up: If everything works as expected, you can now delete the old directory:

1
2
rm -rf ~/.conda_old

Update Conda’s configuration: Conda may have configuration files that reference the old directory. You should update these to reflect the new location. You can find Conda configuration files in ~/.condarc or ~/condarc and in the Conda environment directories themselves.

Verify the symlinks within the directory: If there are relative symlinks within the Conda user data directory that are now broken due to the move, you will need to fix them. You can use the find command to locate broken symlinks:

1
2
find /path/to/new/location/conda_data_backup -type l -ls | grep ' No such file or directory'

Then, you can either manually fix these symlinks or use a script to update their paths accordingly.

By following these steps, you should be able to move your Conda user data directory to another disk and create a symbolic link back to the original location without losing any functionality. Remember to back up your data before making any changes, and ensure that you have the necessary permissions to create symbolic links and write to the new location.

Read More

2024-03-31
解压Electron Asar文件注意

解压asar的时候 注意不要移动app.asar的位置 解压完毕之后再移动

1
2
3
4
5
6
# to prevent 'unable to find xxx in app.asar.unpacked' issue, do not move app.asar yet.
asar e app.asar app
mkdir asar
cp app.asar asar
rm app.asar

Read More

2024-02-01
Telegram 闪退修复

电报偶然一次打开了一个莫名其妙的图片 然后导致每次打开都崩溃

用root权限 在/data/data/org.telegram.messager/files下面删除cache4.db

最近登陆电报不能给国内手机发短信或者打电话了 新注册账号可能需要借助某宝

Read More

2023-12-21
Waydroid Installation Steps

cursed by the wall.

install waydroid package (for ubuntu)

visit and save https://repo.waydro.id/ as waydroid_init_repo.sh, https://repo.waydro.id/waydroid.gpg as waydroid.gpg (using proxy)

comment out the download part in waydroid_init_repo.sh

1
2
# curl --progress-bar --proto '=https' --tlsv1.2 -Sf https://repo.waydro.id/waydroid.gpg --output /usr/share/keyrings/waydroid.gpg

move waydroid.gpg to /usr/share/keyrings/waydroid.gpg

execute sudo bash waydroid_init_repo.sh to setup waydroid repository

on ubuntu you need to use proxy during apt mirror syncing.

to setup proxy (relay local proxy to host):

1
2
3
4
proxy --port <port> --host <host> \
--plugins proxy.plugin.ProxyPoolPlugin \
--proxy-pool localhost:<local_proxy_port>

to use proxy:

1
2
3
sudo env https_proxy=http://<host>:<port> http_proxy=http://<host>:<port> all_proxy=http://<host>:<port> apt update
sudo env https_proxy=http://<host>:<port> http_proxy=http://<host>:<port> all_proxy=http://<host>:<port> apt install waydroid -y

after installation you should comment out the mirror at: /etc/apt/sources.list.d/waydroid.list

initialize waydroid

start waydroid service: sudo systemctl enable --now waydroid-container

the download speed of sourceforge is very slow, unless you use mirror like liquidtelecom

modify the file /usr/lib/waydroid/tools/helpers/http.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
## added part
def is_sourceforge_download_url(url: str):
keywords = ["sourceforge.net", "download"]
return all([kw in url for kw in keywords])
def use_liquidtelecom_mirror(url: str):
# example: https://sourceforge.net/projects/waydroid/files/images/system/lineage/waydroid_x86_64/lineage-18.1-20231216-VANILLA-waydroid_x86_64-system.zip/download
# -> https://sourceforge.net/projects/waydroid/files/images/system/lineage/waydroid_x86_64/lineage-18.1-20231216-VANILLA-waydroid_x86_64-system.zip/download?use_mirror=liquidtelecom
keyword = "use_mirror=liquidtelecom"
if is_sourceforge_download_url(url):
if keyword not in url:
conn_symbol = "?" if "?" not in url else "&"
url += conn_symbol + keyword
return url
## modified part
def download(args, url, prefix, cache=True, loglevel=logging.INFO, allow_404=False):
...
url = use_liquidtelecom_mirror(url)
...
...

restart service: sudo systemctl restart waydroid-container

run command sudo waydroid init

run waydroid in xorg

install weston: apt install weston

configure weston at ~/.config/weston.ini

1
2
3
[core]
xwayland=true

run weston, launch terminal at top left corner, run waydroid

network issue

in addition to the official guide, you also need to enable firewalld or ufw to make it work.

the wifi switch is irrelevant to network. it won’t be turned on.

Read More

2023-02-18
Macos Cleanup Disk And Ram

execute: sudo purge may help with ram issue?

Read More

2022-09-07
What Is Causing My Mac To Freeze When Kali Is Offline

modified scripts:

/Users/jamesbrown/Desktop/works/host_discovery_ssh_local_connect/load_tuntap_launch_n2n_kali_root.sh

/Users/jamesbrown/Desktop/works/host_discovery_ssh_local_connect/nginx_with_kali_finder.sh

/Library/Application Support/ZeroTier/One/launch.sh

seems zerotier one is the main cause!

Read More

2022-09-02
Yaml Special Token Cause Error To Pyyaml

special token like !<str> need to be converted to !!str, while writing back we just do it in reverse.

full reference of pyyaml is here

Read More

2022-08-11
The Kali Command On Macos

debugging

when kali is off, this mac will go crazy and hang everything.

need to scan for kali existance on demand, not all the time.

developing

should we use p2p networks to speed up remote connections like n2n or tinc?

would it be interesting to run all our kali connectors ranged from vscode-ssh-connect, rclone mount and direct ssh connection via kali command dynamically by our kali discovery service, if we can reload the nginx daemon on demand.

using redis to store some daemon reported values.

how about we set the workding directory of redis-server to /tmp so that the dump.rdb file will never take space after reboot?

we need to know if this will successifully launch after reboot since /tmp may not exist by that time

default redis server port: 6379

install redis-server service:

1
2
easyd -w /tmp -l redis_server -- /opt/homebrew/bin/redis-server

first value is online.

next value is kali_ip.

using both value to determine whether to connect to kali or not, and the exact address.

Read More

2022-08-11
Copy Symlink Itself To Change Pyjom'S Location, Install Easyd Services For Macos Local Pyjom Watchdog

1
2
3
cd /media/root/parrot
cp -R -P /media/root/help1/pyjom .

because of the qqChatBot task, pyjom on kali may be syncing too often. need to check the watchdog logs.

turned out it is the __pycache__ dirs to be blamed

disable all sync related services on macos for debug:

main issue happens after local vscode launched.

the issue is such that the proxy setting not right.

to debug the service:

1
2
sudo launchctl debug gui/501/pyjom_local_syncdog --stdout --stderr

1
2
3
4
5
6
# to be succint:
launchctl list | grep syncdog | awk '{print $1}' | xargs -I abc kill -s TERM abc
# instead of:
#launchctl list | grep pyjom_local_syncdog # to get process pid
#kill -s TERM <service_pid>

we need to add some code for it. consider adding something alike to that to kali?

1
2
3
os.environ["http_proxy"]="http://localhost:7930"
os.environ["https_proxy"]="http://localhost:7930"

1
2
3
4
5
6
7
8
9
10
11
launchctl stop gui/501/pyjom_local_watchdog;
launchctl kill TERM gui/501/pyjom_local_watchdog;
launchctl unload gui/501/pyjom_local_watchdog;
launchctl disable gui/501/pyjom_local_watchdog;
launchctl remove gui/501/pyjom_local_watchdog;
launchctl stop gui/501/pyjom_local_syncdog;
launchctl kill TERM gui/501/pyjom_local_syncdog;
launchctl unload gui/501/pyjom_local_syncdog;
launchctl disable gui/501/pyjom_local_syncdog;
launchctl remove gui/501/pyjom_local_syncdog

install macos pyjom watchdog (local):

1
2
easyd -l pyjom_local_watchdog -w /Users/jamesbrown/Desktop/works/sync_git_repos -- /usr/bin/python3 /Users/jamesbrown/Desktop/works/sync_git_repos/watchdog_macos.py

install macos pyjom syncdog (local):

1
2
easyd -l pyjom_local_syncdog -w /Users/jamesbrown/Desktop/works/sync_git_repos -- /usr/bin/python3 /Users/jamesbrown/Desktop/works/sync_git_repos/syncdog_macos.py

Read More

2022-05-06
Letsketch Libwacom

working on archlinux arm:

libwacom 2.1.0-1

not working on kali linux:

libwacom-bin 2.2.0-1

full reference:

https://github.com/DIGImend/digimend-kernel-drivers/issues/514

sudo nano /etc/X11/xorg.conf

Section “InputClass”

Identifier “Tablet”

Driver “wacom”

MatchDevicePath “/dev/input/event*”

MatchUSBID “6161:4d15”

EndSection

to debug input problems:

https://wiki.ubuntu.com/DebuggingMouseDetection#:~:text=In%20case%20your%20mouse%20stops%20working%20after%20a,your%20mouse%20stops%20working.%20...%20More%20items...%20

check /etc/logs/Xorg.0.logs

Read More