Code Snippet Managers for Linux desktops?
Have you seen jCodeCollector? It's a significantly less complicated clone of CodeCollector, but is multiplatform (java). It is available from https://github.com/alessandrococco/jcodecollector
There is also Acire, a project started by Jono Bacon of Ubuntu fame, which is management library for useful python snippets. While full of useful tidbits, it is however, language and linux-specific.
Best way to manage code snippets in Linux?
I think this is what you are looking for: Snippely and jCodeCollector
I use Snippely on my mac, it awesome.
Update: Moved to Dash for mac: http://kapeli.com/dash
Process management code behaves different on Linux and Windows - Why?
The problem is your assumption about btsync. Let's start it:
./btsync
By using this application, you agree to our Privacy Policy, Terms of Use and End User License Agreement.
http://www.bittorrent.com/legal/privacy
http://www.bittorrent.com/legal/terms-of-use
http://www.bittorrent.com/legal/eula
BitTorrent Sync forked to background. pid = 24325. default port = 8888
So, that's the whole story right there: BitTorrent Sync forked to background
. Nothing more. Nothing less. If you want to, btsync --help
tells you to pass --nodaemon
.
Testing Process Termination
Let's pass --nodaemon
run btsync
using the test program. In a separate subshell, let's kill the child btsync
process after 5 seconds:
sehe@desktop:/tmp$ (./test; echo exit code $?) & (sleep 5; killall btsync)& time wait
[1] 24553
[2] 24554
By using this application, you agree to our Privacy Policy, Terms of Use and End User License Agreement.
http://www.bittorrent.com/legal/privacy
http://www.bittorrent.com/legal/terms-of-use
http://www.bittorrent.com/legal/eula
[20141029 10:51:16.344] total physical memory 536870912 max disk cache 2097152
[20141029 10:51:16.344] Using IP address 192.168.2.136
[20141029 10:51:16.346] Loading config file version 1.4.93
[20141029 10:51:17.389] UPnP: Device error "http://192.168.2.1:49000/l2tpv3.xml": (-2)
[20141029 10:51:17.407] UPnP: ERROR mapping TCP port 43564 -> 192.168.2.136:43564. Deleting mapping and trying again: (403) Unknown result code (UPnP protocol violation?)
[20141029 10:51:17.415] UPnP: ERROR removing TCP port 43564: (403) Unknown result code (UPnP protocol violation?)
[20141029 10:51:17.423] UPnP: ERROR mapping TCP port 43564 -> 192.168.2.136:43564: (403) Unknown result code (UPnP protocol violation?)
[20141029 10:51:21.428] Received shutdown request via signal 15
[20141029 10:51:21.428] Shutdown. Saving config sync.dat
Starting Server... ok status: 0
exit code 0
[1]- Done ( ./test; echo exit code $? )
[2]+ Done ( sleep 5; killall btsync )
real 0m6.093s
user 0m0.003s
sys 0m0.026s
No problem!
A Better Fake Btsync
This should still be portable and be (much) better behaved when killed/terminated/interrupted:
#include <boost/asio/signal_set.hpp>
#include <boost/asio.hpp>
#include <iostream>
int main(int argc, char* argv[])
{
boost::asio::io_service is;
boost::asio::signal_set ss(is);
boost::asio::deadline_timer timer(is, boost::posix_time::seconds(20));
ss.add(SIGINT);
ss.add(SIGTERM);
auto stop = [&]{
ss.cancel(); // one of these will be redundant
timer.cancel();
};
ss.async_wait([=](boost::system::error_code ec, int sig){
std::cout << "Signal received: " << sig << " (ec: '" << ec.message() << "')\n";
stop();
});
timer.async_wait([&](boost::system::error_code ec){
std::cout << "Timer: '" << ec.message() << "'\n";
stop();
});
std::copy(argv, argv+argc, std::ostream_iterator<std::string>(std::cout, "\n"));
is.run();
return 0;
}
You can test whether it is well-behaved
(./btsync --nodaemon; echo exit code $?) & (sleep 5; killall btsync)& time wait
The same test can be run with "official" btsync
and "fake" btsync
. Output on my linux box:
sehe@desktop:/tmp$ (./btsync --nodaemon; echo exit code $?) & (sleep 5; killall btsync)& time wait
[1] 24654
[2] 24655
./btsync
--nodaemon
Signal received: 15 (ec: 'Success')
Timer: 'Operation canceled'
exit code 0
[1]- Done ( ./btsync --nodaemon; echo exit code $? )
[2]+ Done ( sleep 5; killall btsync )
real 0m5.014s
user 0m0.001s
sys 0m0.014s
How to create desktop shortcut passing custom arguments?
You need to make the copied chromium.desktop file executable. With Dolphin file manager: right-click on your .desktop file → Properties
→ Permissions
tab → check Is executable
checkbox.
Alternatively, from the folder with your .desktop file, you can run:
chmod 755 chromium.desktop
Now it should be able to launch Chromium.
To add a custom argument(-s) to the launcher - back in the Properties
of your .desktop file go to the Application
tab and add your argument(-s) to the Command
field after the path to the executable, for example:
/usr/bin/chromium --profile-directory="Default"
While we are at the Application
tab, you may want to change the Name
field to something like "Chromium w/args" to help distinguish launchers later on.
As an option, you can edit the .desktop file by opening it with a text editor of your preference. To edit the launch command, navigate to the
[Desktop Entry]
group header, under which locate the line starting withExec=
and add custom arguments to it.To edit the name of the launcher, under the same header locate lines starting with
Name=
(Name[xx_XX]=
, e.g.Name[en_US]=
for localized names) and alter them as you wish.More information on Desktop Entries can be found in its specification or on ArchWiki
To add your new launcher to the application menus (for the current user) - move .desktop file to the
~/.local/share/applications/
Now your launcher will be available in Application Launcher and Krunner.
If you want the new launcher to co-exist with the original (instead of overriding it), you should rename the .desktop file to something like chromium_args.desktop.
How do you manage your gists on GitHub?
Check out GistBox. It supports searching, editing and labels. Here's a screenshot:
There's also a demo video at: http://www.youtube.com/watch?v=VLgyY6lqpsQ
GistBox Clipper (a Chrome extension) also provides the ability to save <pre>
tags and arbitrary text on any web page.
Edit:
Unfortunately, GistBox is becoming Cacher cacher.io - the free plan will only include: 15 private snippets, 3 private labels, unlimited public snippets. If you plan on having many private gists then you will need to but (sic) a paid plan. – Bartek Skwira
In KDE, how can I automatically tell which Desktop a Konsole terminal is in?
With dcop, the kde Desktop COmmunication Protocol, you could easily get current desktop executing
dcop kwin KWinInterface currentDesktop
command. If you are working with new kde 4.x dcop is no more used, and you can translate the command to a DBUS call. It should be quite simple to send/get dbous messages with python apis.
Sorry for my bad english,
Emilio
Managing keyboard shortcut conflicts between IDE and OS (Ubuntu)
I use Ubuntu as well and I disabled the native (Ubuntu) command Ctrl + Alt + L because I prefer IntelliJ's format code than this native Ubuntu command. However, in the 2nd case I prefered Ubuntu's shortcut so I didn't change anything.
So basically, you can choose which option you need more and then act accordingly.
Of course, until IDEA becomes Ubuntu friendly.
In the end, Ubuntu will always prefer its shortcuts and so far I haven't found any tool that can disable native shortcuts on request.
Related Topics
Bash VS Csh VS Others - Which Is Better for Application Maintenance
Should Linux Cron Jobs Be Specified with an "&" to Indicate to Run in Background
Can't Use a Variable Out of While and Pipe in Bash
How to Find Out What Group a Given User Has
What Is a Sysroot Exactly and How to Create One
.Htaccess Not Working (Mod_Rewrite)
How to Convert ".." in Path Names to Absolute Name in a Bash Script
Are Unix Reads and Writes to a Single File Atomically Serialized
How Does a Linux Socket Buffer Overflow
How to Convert String to Number in Gnuplot
What Does Double Slash // in 'Cd //' Mean in Linux
Importing Shapefiles in Postgresql in Linux Using Pgadmin 4
What Occurs When a File Is 'Source'-D in Unix/Linux Context
How to Continue One Thread at a Time When Debugging a Multithreaded Program in Gdb
Gurus Say That Ld_Library_Path Is Bad - What's the Alternative