Skip to content

Instantly share code, notes, and snippets.

@samgooi4189
samgooi4189 / transmission-samba-simple.txt
Last active September 3, 2024 01:31
setup trasmission and samba on antix debian
1. install transmission-daemon and samba
2. mkdir /transmission-share
3. sudo usermod -a -G debian-transmission $(whoami)
4. sudo chgrp debian-transmission /transmission-share
5. sudo chmod 770 /transmission-share
6. sudo vim /etc/transmission-daemon/settings.json
change download_dir to /transmission-share
change umask from 18 to 2
append rpc-whitelist with 192.168.*.*
reference: https://askubuntu.com/questions/221081/permission-denied-when-downloading-with-transmission-daemon
@samgooi4189
samgooi4189 / synology-transmission-note.txt
Last active November 13, 2021 08:22
Synology transmission change username and password
It is imperitive that you need to change 2 files in order to prevent transmission to overwrite your changes.
The default credential is admin:admin
1. SSH into your synology
2. edit /var/packages/transmission/target/var/settings.json to change the username and password
3. edit /var/packages/transmission/var/settings.json to change the username and password
To understand how the username and password get inserted into the settings.json, you can read /var/packages/transmission/scripts/service-setup
@samgooi4189
samgooi4189 / ruby20210601-command.txt
Last active June 1, 2021 12:59
ruby workshop 20210601 cheat sheet
# clone and cd into your repo
create config/master.key
38e8eded99cab7f153507c62c5093659
# Add non-root user
useradd --create-home --shell /bin/bash deploy
sudo usermod -aG sudo deploy
sudo echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
su deploy
cd
@samgooi4189
samgooi4189 / deviseSignInUnknwonFormatFix
Created November 7, 2020 03:30
Devise UnknownFormat when sign_in with API
The fix is just adding
`
respond_to :json
`
to your custom SessionsController
The reason is that the parent session controller does not know how to respond when respond_with is being called.
@samgooi4189
samgooi4189 / sample.txt
Last active May 5, 2022 13:55
wget file from private repo
bitbucket does not send challenge https://developer.atlassian.com/server/bitbucket/how-tos/example-basic-authentication/#supplying-basic-auth-headers
$ wget --http-user="samgooi4189" --http-password="MpBrJa9dC3vkWgmTcjLF" --auth-no-challenge "https://api.bitbucket.org/2.0/repositories/samgooi4189/bitbucket-download-test/src/master/README.md"
--2020-09-02 22:21:57-- https://api.bitbucket.org/2.0/repositories/samgooi4189/bitbucket-download-test/src/master/README.md
Resolving api.bitbucket.org (api.bitbucket.org)... 18.205.93.6, 18.205.93.7, 18.205.93.8, ...
Connecting to api.bitbucket.org (api.bitbucket.org)|18.205.93.6|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2622 (2.6K) [text/plain]
Saving to: ‘README.md’
@samgooi4189
samgooi4189 / someclass.java
Last active January 5, 2020 02:54
Create preemptive compute engine with java
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.compute.Compute;
import com.google.api.services.compute.ComputeScopes;
import com.google.api.services.compute.model.*;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
@samgooi4189
samgooi4189 / step_dual_boot_osx_windows
Created November 9, 2019 14:41
Dualboot OSX and windows 10
1. install osx
2. install win 10
3. You will find that windows boot manager will make clover dissapear from bios
4. in Windows terminal, run as admin, Bcdedit /set {bootmgr} path \EFI\BOOT\BOOTX64.efi
5. You now able to boot to clover
@samgooi4189
samgooi4189 / cytron_esp32_install.txt
Created October 8, 2019 05:41
Cytron espruino ESP32 installtion
1. pip install esptool
2. Download all three files from http://www.espruino.com/Download, which includes bootloader.bin, espruino_esp32.bin, partitions_espruino.bin
3.
esptool.py \
--chip esp32 \
--port /dev/ttyUSB0 \
--baud 115200 \
--after hard_reset write_flash \
-z \
--flash_mode dio \
@samgooi4189
samgooi4189 / step_to_add_kernel_jupyter
Created August 23, 2019 06:36
Add custom kernel to jupyter notebook
Make jupyter notebook to use virtualenv
1. virtualenv ENVNAME
2. source ./ENVNAME/bin/activate
3. pip install ipykernel
4. python -m ipykernel install --user --name ENVNAME --display-name "Python (whatever you want to call it)"
@samgooi4189
samgooi4189 / ubuntu_desktop_app
Created August 22, 2019 14:28
Create desktop shortcut for program in Ubuntu
Create a file ( Desktop File ) with this content:
[Desktop Entry]
Version=1.0
Name=Android Studio
Type=Application
Icon=/PATH/TO/ICON/studio.png
Exec=/PATH/TO/studio.sh
Change /PATH/TO/ICON/studio.png and /PATH/TO/studio.sh accordingly.
save the file as: android-studio.desktop in /usr/share/applications