recentpopularlog in

kme : automation   329

« earlier  
Access clipboard in Windows batch file - Stack Overflow
tl;dr:
<code class="language-powershell">get-clipboard</code>

(works on Windows 10 at least)

The alternatives are ghastly:
Slimming it down (on a new enough version of Windows):
<code class="language-powershell">set _getclip=powershell "Add-Type -Assembly PresentationCore;[Windows.Clipboard]::GetText()"
for /f "eol=; tokens=*" %I in ('%_getclip%') do set CLIPBOARD_TEXT=%I</code>

- First line declares a powershell commandlet.
- Second line runs and captures the console output of this commandlet into the CLIPBOARD_TEXT enviroment variable (cmd.exe's closest way to do bash style backtick ` capture)


(and that was one of the _concise_ solutions)
windows  powershell  cli  shellscripting  clipboard  automation  ayfkm  microsoft  whynotpowershell  alternativeto  xclip  pbcopy  pbpaste 
8 weeks ago by kme
cmd - How can you get the clipboard contents with a Windows command? - Stack Overflow
<code class="language-dos">powershell -command "Get-Clipboard" > file.txt</code>

This cannot be stored in a DOSKEY macro, because those can't be used in pipes.
windows  cmd  powershell  clipboard  cli  automation  pipes  workaround  sortof  solution 
8 weeks ago by kme
List commits between 2 commit hashes in git - Stack Overflow
I ended up using
<code class="language-bash">git log -L 150,180:builtins/shopt.def bash-4.1.11..bash-4.3</code>
to solve the problem I was having (which version of Bash introduced the 'direxpand' option to 'shopt'; hint: 4.2.29)

See also: https://unix.stackexchange.com/q/498857/278323
devel  git  commit  history  automation  forensics  sortof  solution 
8 weeks ago by kme
How to list all tags of a docker image
This is one way to do this, and it works. See also this Gist, which 'docker pulls' a bunch of Bash images to see if that version of Bash has a certain 'shopt' option: https://gist.github.com/ernstki/b782cc7f2a29ec01c1f4355f2dd312cc.
<code class="language-bash">
image=debian
for (( i=0; $?==0; i++ )); do
i=$((i+1))
curl -sL https://registry.hub.docker.com/v2/repositories/library/$image/tags/?page=$i 2>/dev/null \
| jq -r '.results[]["name"]'
done</code>
You can also get the total number of tags from the "count" attribute of the first JSON response, which also gives you the "next" URL.

Possibly see also: https://docs.docker.com/v17.09/registry/spec/api/, but I don't know what the difference between Docker Hub, Docker Registry, and a Docker "Trusted" Registry is, or which one exactly the public Docker Hub is.
docker  cli  commandline  containers  automation  sysadmin  solution 
8 weeks ago by kme
SSH tunnelling for fun and profit: Autossh
<code class="language-bash">autossh -M 0 -f -T -N cli-mysql-tunnel</code>

And make sure that you have set some value for 'ServerAliveInterval' and 'ServerAliveCountMax':
Unfortunately, this is not too handy, as it must be made sure both ports (the specified one and the one directly above) a free (not used). So in order to overcome this problem, there is a better solution:

ServerAliveInterval and ServerAliveCountMax – they cause the SSH client to send traffic through the encrypted link to the server. This will keep the connection alive when there is no other activity and also when it does not receive any alive data, it will tell AutoSSH that the connection is broken and AutoSSH will then restart the connection.


For example:

<code class="language-bash">autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3"</code>
automation  ssh  sshtunnelling  vpn  remoteaccess  reference  solution 
9 weeks ago by kme
peritus/bumpversion: Version-bump your software with a single command
Pretty handily replaces what I used to use a complicated custom Makefile for, except that it *only* does version numbers, not "last updated" dates or anything like that.

Handy note:
Options on the command line take precedence over those from the config file, which take precedence over those derived from the environment and then from the defaults.
python  versionnumber  distribution  deployment  automation  alternativeto  makefile 
11 weeks ago by kme
[dev] Re: Auto-preview man pages from Charles Lehner on 2016-01-09 (dev mail list archive)
You could also send mupdf a SIGHUP signal to tell it to reload, instead of spawning a new mupdf:
<code class="language-bash">
mupdf address.pdf & pid="$!"
echo address.yaml | entr sh -c "make address.pdf && kill -HUP $pid"</code>
entr  automation  manpage  commandline  devel  tipsandtricks 
july 2019 by kme
tmux send-keys syntax - Stack Overflow
This didn't seem to work for sending Enter,Enter,~,. (to disconnect a non-responsive SSH session); but then again, maybe I never had an SSH session to begin with ('bsub -Is' not 'bsub -ISs').
tmux  automation  reference 
july 2019 by kme
Adding custom commands to setup.py
This was implemented in b682a380 of seq-core-ngs-downloader.
python  setuptools  setup.py  installation  setup  customization  packaging  release  automation 
june 2019 by kme
bats-core/bats-core: Bash Automated Testing System | https://github.com/
Bash Automated Testing System. Contribute to bats-core/bats-core development by creating an account on GitHub.
shellscripting  bash  testing  framework  unittesting  automation  devel  alternative  to  ts  bats 
january 2019 by kme
qvl/sleepto: An alternative to traditional task schedulers | https://github.com/
An alternative to traditional task schedulers. Contribute to qvl/sleepto development by creating an account on GitHub.
unix  sysadmin  cronjob  scheduler  automation  alternativeto  cron 
january 2019 by kme
[Request] Copy and transfer text from Notes app to Simplenote : workflow | https://www.reddit.com/
OR I think it can be done using IFTTT, if it has a Simplenote channel. You'd need to add a gmail account on Mac and enable notes, then select all notes and move to gmail from iCloud. Before that, setup IFTTT to trigger on gmail label added "Notes" (check this) copy mail to Simplenote. Notes on Mac and iOS actually uses IMAP mailboxes/labels. This is what makes it possible.
simplenote  ifttt  notetaking  notes.app  mac  osx  automation  maybesolution 
january 2019 by kme
Running Selenium with Headless Chrome | https://intoli.com/
<code class="language-python">from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('headless')
</code>
chrome  webdevel  selenium  automation  testing  webdriver  python  solution 
october 2018 by kme
eradman / treedelta — Bitbucket | https://bitbucket.org/
The td utility makes it easy to see what files were added or removed during the execution of a command. The child process is executed with a pipe that relays a list of files that were provided to td on STDIN. When the child process exits, each unique path is re-scanned and a delta is printed to STDERR.
automation  commandline  cli  differ  diff  filemanagement  utility  software 
october 2018 by kme
Online dating is so awful that people are paying virtual dating assistants to impersonate them — Quartz | https://qz.com/
But legality aside, these cut-and-paste flirtations perpetuate negative gender stereotypes, and they reinforce an oversimplified (and destructive) view of romantic expectations.
Men and women on online-dating platforms therefore learn to emulate personalities that yield quantifiable results.

As dating platforms become flooded with calculated, flirtatious spam, men and women on these sites learn to emulate personalities that yield quantifiable results. This means playing down unique traits and unorthodox views to the point where a total stranger—like me—could literally do it in their place. By trying to appeal to dozens, if not hundreds, of strangers at the same time, we forfeit our ability to take risks and experiment with social norms; only placing safe bets robs us of new and genuine experiences.

But the steepest price of this online anonymity appears to be human decency, which—as I’m often reminded at ViDA—doesn’t lead to dates.

For example, one match told me that she’d just put down her family dog. Still in training, I wasn’t sure what to do. I wrote out an apology for her loss and sent it to my instructor for approval. He crossed out my response and wrote underneath: “Alpha Males don’t apologize.” What we sent back instead was an upbeat story about our client’s two dogs, which was a shamefully inconsiderate reply in my view. I expected to never hear back from her, but three exchanges later, she was sending me her phone number.

It was my first commission: $1.75.

Had she blamed my client’s callous response on internet miscommunication? Or was she learning—just as I was—that reaching out for a unique connection online would lead only to awkwardness and rejection? Every time she has an interaction in which her feelings are ignored—whether it’s online or in-person—I worry that she’ll learn not to talk about her emotional needs, or any needs of any kind.

As we grow accustomed to foisting more and more complicated emotional tasks onto digital butlers, we lose our ability to tolerate inelegance or find value in social failure. Moments of awkwardness and heartbreak are an inevitable part of the dating experience, and they are essential in our evolution into mature adults. By outsourcing our courtship to robots (and robot-like humans) we might save ourselves some pain in the short term, but it degrades us, simplifies us, and fails to provide for our ultimate goal of finding someone accepting of our flaws. In this age of automation, romance isn’t just one click away—it’s guaranteed.
onlinedating  relationships  theinternet  automation  asaservice  outsourcing 
september 2018 by kme
How to import CSV file to MySQL table - Stack Overflow | https://stackoverflow.com/

phpMyAdmin can handle CSV import. Here are the steps:

1. Prepare the CSV file to have the fields in the same order as the MySQL table fields.
2. Remove the header row from the CSV (if any), so that only the data is in the file. (not necessary --Ed.)
3. Go to the phpMyAdmin interface.
4. Select the table in the left menu.
5. Click the import button at the top.
6. Browse to the CSV file.
7. Select the option "CSV using LOAD DATA".
8. Enter "," in the "fields terminated by".
9. Enter the column names in the same order as they are in the database table.
10. Click the go button and you are done.

This is a note that I prepared for my future use, and sharing here if someone else can benefit.
database  dba  mysql  import  automation  csv  tabdelimited  solution  importexport 
january 2018 by kme
GitHub - AutoKey, a desktop automation utility for Linux and X11
Looks like you need to install either or both of libdbus-1-dev and libdbus-glib-1-dev.

On later Ubuntus (18.x-ish) and elementaryOS Juno (5.0) you randomly needed to install gir1.2-gtksource-3.0, otherwise you get an error about namespaces not being available.
automation  hotkey  scripting  python  python3  needshelp  alternativeto  texter  textexpander  phraseexpress 
november 2017 by kme
« earlier      
per page:    204080120160

Copy this bookmark:





to read