|
my bitter bi rival posted:
Allow me to introduce you to our Lord and savior, jq
|
# ? Nov 2, 2018 03:45 |
|
|
# ? Apr 18, 2024 03:10 |
|
my bitter bi rival posted:I'm not sure if this is the right thread for this (hopefully it is) but I am trying to write a sed one liner to find a string which is wrapped in curly braces, and then once its found that string, expand the selection to the leading and trailing curly braces, and then delete everything. Is there any particular reason you're treating this as a regular string and not the structured data that it is? Can you tell us what you're actually trying to do
|
# ? Nov 2, 2018 03:53 |
|
Use jq, or a json parsing lib in your favorite language that isn’t Bash. You can do this super easily in Python or Ruby or whatever. Or tell us why this has to be bash.
|
# ? Nov 2, 2018 04:20 |
|
Ryaath posted:Allow me to introduce you to our Lord and savior, jq Thanks, I'll check this out. Methanar posted:Is there any particular reason you're treating this as a regular string and not the structured data that it is? No, no reason at all. When I started working on this, I did briefly look at jq, but I don't have a ton of experience with JSON and I wasn't sure if something like that would work because of the => symbols. I also wasn't sure if that data actually was in JSON format because of the => symbols. Also, there are some strings at the beginning of this file, and I thought that might affect how the file was read. So I thought sed would be easiest, and then started having the issues which led me to post. Basically just didn't know any better. As for what I am doing, I am just trying to automate a workflow for myself. I am working on something that requires me to run a few bash commands, then I need to edit this file to delete a reference to the package (the part from my original post), and then run a few more commands that read that file once the string (data object?) has been removed. Docjowles posted:Use jq, or a json parsing lib in your favorite language that isn’t Bash. You can do this super easily in Python or Ruby or whatever. It doesn't have to be in bash. I was actually looking at Ruby potentially being easier to work with, I have a little experience with that and it looks like its just a couple of lines of Ruby. The only reason I was doing it in bash is this is one step out of a dozen or so, and the other steps are just bash commands. I started writing a shell script that was just the bash commands I needed to run, then I realized I forgot this step, and went back and tried to work it in with sed, which seemed like the most sensible tool to use at the time. post hole digger fucked around with this message at 06:40 on Nov 2, 2018 |
# ? Nov 2, 2018 06:38 |
|
The => is a bit weird but 's/ => /:/g' probably gets you to real json and then its easy to delete keys named package. If you want, you can heredoc ruby code into the interpreter to keep everything in one big shell script.
|
# ? Nov 2, 2018 06:58 |
|
Since the file I have to work with is not quite standard JSON and contains a few oddities (commented out blocks, => symbols, variables defined at the top of the file), I didn't want to spend too much more time trying to get jq to play nice with it, and I've gone the hacky ruby route. Here is what I ended up with if anyone cares. After I added some parenthesis around the regex, it works for my needs.code:
post hole digger fucked around with this message at 19:34 on Nov 2, 2018 |
# ? Nov 2, 2018 19:31 |
|
So, today's the day Dropbox stops working for me. What are people switching to? Need something easy to use headless.
|
# ? Nov 7, 2018 16:45 |
|
SurgicalOntologist posted:So, today's the day Dropbox stops working for me. What are people switching to? Need something easy to use headless.
|
# ? Nov 7, 2018 18:22 |
|
Since crashplan died I have been using Jottacloud. It is cheap as chips and works with rclone. It seems good so far. I hope it doesn't disappear...
|
# ? Nov 7, 2018 19:59 |
|
SurgicalOntologist posted:So, today's the day Dropbox stops working for me. What are people switching to? Need something easy to use headless. I’ve been using resilio sync for the last year or so with no issues. It’s not a hosted solution, but with at least one other PC on at any point in time, it replicates across my systems well. It also gets bonus points because it does it over LAN when it can, and can punch through NAT when it can’t.
|
# ? Nov 7, 2018 20:30 |
|
I've been using SyncThing (with my home system that's almost always on as the main sync point) combined with a free Google Drive for a few files I want on my phone immediately accessible but not synced physically.
|
# ? Nov 8, 2018 02:46 |
|
Syncthing on my home server which is running CentOS - almost always on. Syncthing on a Linode VPS that costs me about £10/month and I use for other poo poo - almost always on. Syncthing on various Windows and Linux boxes that get turned on and off. The two nodes that are almost always on ensure that the sync is permanently running. As an emergency fallback, the home server does a nightly cronjob to ``rsync --delete`` my Syncthing folder at 2am in the morning. If This is for everyday work documents and random poo poo that I throw around. Anything worth keeping that I Syncthing during the day gets moved somewhere more permanent when I get home.
|
# ? Nov 8, 2018 15:53 |
|
Trying to install Ubuntu server on an existing rig with a zpool is sure frustrating. curtin is spotting the ZFS disks and is trying to call zpool despite the ZFS not being part of the distro out of the box, therefore failing. I mean, the gently caress why even?
|
# ? Nov 11, 2018 22:16 |
|
apropos man posted:As an emergency fallback, the home server does a nightly cronjob to ``rsync --delete`` my Syncthing folder at 2am in the morning. If I have a very similar setup, but since the backup location (a remote VPS) has stupid amounts of space available compared to what I'm backing up, I just have a cron job to do this every night: code:
I'm sure there's a more elegant way to do this, with zfs snapshots or something, but hey, this took me about thirty seconds to code up.
|
# ? Nov 11, 2018 22:38 |
|
Powered Descent posted:I have a very similar setup, but since the backup location (a remote VPS) has stupid amounts of space available compared to what I'm backing up, I just have a cron job to do this every night: Hmm. Yeah, I could add that quite easily. Let's say my Syncthing directory is at /home/foo/sync and my nightly fallback directory is at /home/foo/accident Currently it would be, an rsync like this: rsync -a --delete /home/foo/sync/ /home/foo/accident/ All I would need to do is generate a random directory every night, perhaps using uuidgen: I just knocked this up: code:
You can easily list the randomly named directories by the night they were created by using 'ls -ltr' and find which day you thought you borked a file. I forget why -mtime actually finds files a day greater than the number that you give it, but there's a reason for it if you feel like Googling it. EDIT: Ooops! I was tired last night and missed out a plus sign. That mtime argument should be '-mtime +3', not '-mtime 3'. DOH!! apropos man fucked around with this message at 07:50 on Nov 12, 2018 |
# ? Nov 11, 2018 23:00 |
|
Combat Pretzel posted:Trying to install Ubuntu server on an existing rig with a zpool is sure frustrating. curtin is spotting the ZFS disks and is trying to call zpool despite the ZFS not being part of the distro out of the box, therefore failing. I mean, the gently caress why even? In my admittedly limited experience, trying to install Ubuntu on anything except clean disks is a disaster. I crashed the 16 installer I don't know how many different ways just trying to preserve an existing LVM setup on one machine, and I had to manually edit some files in the 18.04 installer so it wouldn't crash repeatedly too. Sheep fucked around with this message at 01:19 on Nov 12, 2018 |
# ? Nov 12, 2018 01:16 |
|
I have a new XPS 13 with 4k screen running Fedora 29 with KDE. I love the laptop to death but I have to force a higher DPI to make things readable on the laptop screen since it's only 13 inches. However, I also bought a 32 inch monitor and a fancy Dell dock so I can look at the bigger screen when I am working from home. The scaling makes everything look blurry when the laptop is docked. I am wondering if there is a way to enable scaling when the display is output via the laptop screen BUT disable scaling when the display is over the 4k monitor? So far, all I've been able to do is adjust the DPI manually (which requires me to log out and back in again to take effect).
|
# ? Nov 13, 2018 04:12 |
|
Which version of which desktop environment, backed by which display protocol? If it’s anything X, no. I think I heard about Gnome under wayland getting support for mixed dpi displays, but I don’t have any first hand experience with it. No idea about KDE, but if wayland supports mixed dpi it should get support... eventually. I just set my internal display to 1080p when external displays are plugged in. Usually the WM will revert it back to 4K when you unplug them.
|
# ? Nov 13, 2018 08:36 |
|
Horse Clocks posted:Which version of which desktop environment, backed by which display protocol? Not sure what additional info you are looking for. Here is a screenshot showing my system details.
|
# ? Nov 13, 2018 18:11 |
|
Is that conky? That takes me back. Back to around the days of Ubuntu Gutsy Gibbon. I might actually give it a whirl.
|
# ? Nov 13, 2018 20:57 |
|
apropos man posted:Is that conky? I had Conky setup with Gnome but it's a pain in the rear end to get it moved wherever I want it. This is a KDE Plasma Widget called Simple Monitor.
|
# ? Nov 13, 2018 21:42 |
|
Cool!!
|
# ? Nov 13, 2018 22:25 |
|
if you're using KDE, it's a crime to not use the "Picture of the day" wallpaper.
|
# ? Nov 13, 2018 22:26 |
|
I tried "Picture of the day", and it's good but I can see it clashing with Simple Monitor. I was using the old Manjaro desktop wallpaper because I quite liked the retro colours but the stock Fedora one looks good with Simple Monitor. Why it took me so long to get rid of the ugly Home and Wastebin directories from my desktop, I'll never know!
|
# ? Nov 13, 2018 22:42 |
|
I have been using Variety to change the wallpaper periodically.
|
# ? Nov 13, 2018 23:22 |
|
Nostalgia4Ass posted:I have a new XPS 13 with 4k screen running Fedora 29 with KDE. I love the laptop to death but I have to force a higher DPI to make things readable on the laptop screen since it's only 13 inches. However, I also bought a 32 inch monitor and a fancy Dell dock so I can look at the bigger screen when I am working from home. The scaling makes everything look blurry when the laptop is docked. I am wondering if there is a way to enable scaling when the display is output via the laptop screen BUT disable scaling when the display is over the 4k monitor? So far, all I've been able to do is adjust the DPI manually (which requires me to log out and back in again to take effect). Horse Clocks posted:Which version of which desktop environment, backed by which display protocol? Could you not use xrandr to scale the lower DPI monitor after setting dpi to the 4k monitor? Man xrandr and look at --dpi, --mode and --scale. I can't test this so I'm not 100% sure this will work. Edit: If you are using X. If Wayland, please ignore.
|
# ? Nov 15, 2018 04:38 |
|
RHEL 8 Beta is out: http://redhat.com/en/blog/powering-its-future-while-preserving-present-introducing-red-hat-enterprise-linux-8-beta Still uses systemd smdh.
|
# ? Nov 15, 2018 15:51 |
|
What's the status on DNF? Got symlinks to yum? edit - scrolled down and actually read, using yum 4. Which is DNF, right? I can't keep this poo poo straight anymore.
|
# ? Nov 15, 2018 15:58 |
|
other people posted:RHEL 8 Beta is out: Probably responding to a joke/troll, but what would they reasonably replace systemd with at this point? In before "sysv init as god intended"
|
# ? Nov 15, 2018 16:07 |
|
Docjowles posted:Probably responding to a joke/troll, but what would they reasonably replace systemd with at this point? docker!
|
# ? Nov 15, 2018 16:38 |
|
xzzy posted:docker! supervisord
|
# ? Nov 15, 2018 16:49 |
|
other people posted:RHEL 8 Beta is out: "Linux containers, Kubernetes, artificial intelligence, blockchain and too many other technical breakthroughs to list all share a common component - Linux, the same workhorse that has driven mission-critical, production systems for nearly two decades." Blockchain!!!!
|
# ? Nov 15, 2018 17:16 |
|
Salt Fish posted:"Linux containers, Kubernetes, artificial intelligence, blockchain and too many other technical breakthroughs to list all share a common component - Linux, the same workhorse that has driven mission-critical, production systems for nearly two decades." I'm a bit afraid of systemd artificial intelligence. Someone is going to but a kill all humans rule before asimov.d and we'll all die.
|
# ? Nov 15, 2018 17:41 |
|
Hating systemd is a meme and nobody who actually knows what they're doing prefers it over init scripts.
|
# ? Nov 15, 2018 17:43 |
|
other people posted:supervisord No process reaping functionality. And it can't make coffee for me.
|
# ? Nov 15, 2018 18:11 |
|
Docjowles posted:Probably responding to a joke/troll, but what would they reasonably replace systemd with at this point? The cloud!
|
# ? Nov 15, 2018 18:28 |
|
How do I get around this error when trying to install an Ubuntu VM on the command line with virt-install:code:
|
# ? Nov 15, 2018 21:15 |
|
Here's a dumb question for the thread. For reasons, I've been using Atom as my text editor (in windows and linux). I have it setup with Git to push my note folder to a gitlab repository, so I have my notes backed up and I can sort of sync them. I'm having a hard time finding an Atom package that will auto-save periodically and also auto-git add/commit/push on edit. I know there's probably an easier way to do this, but I'm trying to get this to work. I did find this: https://atom.io/packages/sync-on-save which says it does what I want, but I don't know how to setup the git hook that it wants.
|
# ? Nov 15, 2018 22:57 |
|
Trying out Ubuntu 18.10. Is it normal for many snaps from the store to just.. not work? Either they refuse to install or they install and won’t launch. Seems like the ones I have trouble with were published by “Snapcrafters” and not the developer.
|
# ? Nov 16, 2018 00:11 |
|
|
# ? Apr 18, 2024 03:10 |
|
Snapcrafters? Does that mean I can repackage popular apps with malware, and upload them?
|
# ? Nov 16, 2018 18:52 |