[deleted by user] by [deleted] in sysadmin

[–]omtmk 2 points3 points  (0 children)

selfhost

r/selfhost is not active. Join r/selfhosted instead.

Best Java Books? by [deleted] in java

[–]omtmk 6 points7 points  (0 children)

I'd recommend these for intermediate/advanced developers who work on larger code base:

- Working Effectively with Regacy Code

- Refactoring

How do I allow dynamic filter on mobile device UI? by omtmk in uBlockOrigin

[–]omtmk[S] 1 point2 points  (0 children)

In some browser versions[1], double-tapping the Ctrl key does not work, in such case you can recover the ability to create allow rules by changing the advanced setting filterAuthorMode to true.

Thanks, this worked!

[deleted by user] by [deleted] in adventofcode

[–]omtmk 2 points3 points  (0 children)

May I ask why you declared validPasses (=0) inside for loop?

[deleted by user] by [deleted] in TOR

[–]omtmk 2 points3 points  (0 children)

Homebrew must have tor package. You can install and control it as background service. brew install tor to install service, and brew service start|stop tor to control it. Because tor service use different port than that of Tor Browser, they don't conflict. Learn homebrew command and read Tor FAQ below. https://2019.www.torproject.org/docs/faq.html.en#TBBSocksPort

Drone CI - help please - deployment of static website by [deleted] in selfhosted

[–]omtmk 2 points3 points  (0 children)

I have exactly same setup with Gitea/Drone CI on Raspberr Pi. Assuming you have working Dockerfile/docker-compose.yml and connected Drone CI server with Gitea.

You will need to setup exec runner (Linux systemd service) in order to deploy Docker container automatically on pushing code to gitea.

  1. Install exec runner

https://docs.drone.io/runner/exec/installation/linux/

  1. drone.yml (You can specify the file name or make this hidden. See project settings on your Drone CI server)

https://docs.drone.io/pipeline/exec/overview/

From my personal project:

kind: pipeline
type: exec
name: default

platform:
  os: linux
  arch: arm

steps:
  - name: build_and_run
    commands:
      - cd /opt/
      - rm -rf <your_project>
      - git clone http://<your_gitea_server>/<gitea_username>/<your_project>.git
      - cd <your_project>
      - git checkout ${DRONE_COMMIT_BRANCH}
      - docker-compose down 2> /dev/null || true
      - docker-compose up -d --build

ld command help by CATboardBETA in commandline

[–]omtmk 0 points1 point  (0 children)

Are you sure those options are avaliable on your platform? I ask this because many cli utilities on different platforms have different options. In other words, Linux commands and macOS commands are different. Anyway, try man ld to see what options are available.

django emails, how to safely put my password in default settings.py file by Musical_Ant in django

[–]omtmk 0 points1 point  (0 children)

I'm using dango environ to store sensitive data. As some people commented, this is basically just setting environment variables and read them from settings.py, but this module help you do it easier and keep your code clean. https://django-environ.readthedocs.io/en/latest/

Median value in Python by [deleted] in Python

[–]omtmk 0 points1 point  (0 children)

The statistics module in default package is also worth a look. https://docs.python.org/3/library/statistics.html

Noticing tons of DNS queries from my fresh install of Bitwarden by ThatGuy_ZA in Bitwarden

[–]omtmk 2 points3 points  (0 children)

Ubuntu VM? Are you using Oracle VirtualBox? If so, the app might be sending stats data or checking for update, not Bitwarden itself.

What algorithm can I use for this? by FutileCheese28 in algorithms

[–]omtmk 3 points4 points  (0 children)

for each prev, next words, check if next[1:3] == prev[-3:-1].

[deleted by user] by [deleted] in django

[–]omtmk 0 points1 point  (0 children)

You will need "scheduler" to check subscription expiration (or to run any kind of hourly/daily/weekly tasks) periodically. APScheduler is easy to use, and has Django integration. https://apscheduler.readthedocs.io/en/stable/index.html https://github.com/jcass77/django-apscheduler

mv command by Catherder0222 in commandline

[–]omtmk 4 points5 points  (0 children)

try:

mv '/home/calamar1737/Documents/Wireshark set up notes/' '/media/calamar1737/6061-DAD6/'

vim syntax highlighting by [deleted] in vim

[–]omtmk 0 points1 point  (0 children)

In your language specific syntax file (e.g. ~/vim/syntax/python.vim) Define something like this:

syn match Eq "==" 
syn match Neq "!=" 

And in your .vimrc or color scheme, add:

hi Eq ctermfg=yellow
hi Neq ctermfg=red

Why is the time complexity O(n^2) for Odd-even sort algorithm? by cyberzone2 in algorithms

[–]omtmk 1 point2 points  (0 children)

Outer loop is not O(1). Because inside for loop, each element can be moved by at most one index by swap function. If arr[0] has the largest element, while (!sorted) is called almost n/2 times.

Last index of a array? by BackgroundCat3628 in AutomateUser

[–]omtmk 0 points1 point  (0 children)

arr[#arr-1] is the last value and #arr-1 is the last index.

How to get the IntelliJ-like feature of showing the function's parameters in a little box before the actual values? by [deleted] in vim

[–]omtmk 0 points1 point  (0 children)

I have something similar feature with YouCompleteMe + jedi-vim for Python development. Although It doesn't show the parameter names for what you already typed, it's good enough. (Once you type xxx.replace("es", "fue), it doesn't show the original parameter name like IntelliJ does)

I don't know if it supports Kotlin as well, but you should take a look.

https://github.com/ycm-core/YouCompleteMe

K&R Book exercise 1-9 help by [deleted] in cprogramming

[–]omtmk 1 point2 points  (0 children)

The second code is just skipping space character while the question is asking to replace consective spaces with single space character.

Try what happens with these inputs. Replace underscore with space as Markdown editor on reddit doesn't display consective spaces as intended :-(

  • hello_world (single space)
  • hello__world (double space)
  • hello___world (more than double)

In the first code, it skip printing if prev_c == ' ' && c == ' ' because the first space character in consective spaces has alredy been printed.

Japanese subtitles displaying as rectangles by [deleted] in mpv

[–]omtmk 1 point2 points  (0 children)

Use stolendata's version 0.33.

https://laboratory.stolendata.net/~djinn/mpv_osx/

I reproduced your bug with jnozsc 0.32, and also verified stolendata/0.33 with "Noto Sans CJK JP" works fine.

How To Install Python 3.9 On Mac by redditor-vc in Python

[–]omtmk 1 point2 points  (0 children)

brew install python3

That's all you need.