Tmux-powerline status-interval make flicker - tmux

Mac OSX El Capitan
Tmux 1.9a
powerline https://github.com/erikw/tmux-powerline
Sometimes the status line flash, the segments will disappear and then appeare.
If I config the
set-option -g status-interval=5
it seems better but that is not the real time status .
Is that the normal phenomenon?
Or maybe I should do some config to avoid this.

It sounds like one of your segments is doing something that takes a long time to update. You can disable segments to see if that helps (configuration docs). The defaults are pretty expensive, and on my older MacBook, tmux regularly sits at 5% CPU or more. Disabling uptime and anything else you don't need might help.
Here's an example config where I trimmed some of the fat from the right status (removed uptime, system load, removed the seconds from the time). This goes in
~/.config/powerline/themes/tmux/default.json:
{
"segments": {
"right": [
{
"function": "powerline.segments.common.time.date"
},
{
"function": "powerline.segments.common.time.date",
"name": "time",
"args": {
"format": "%H:%M",
"istime": true
}
},
{
"function": "powerline.segments.common.net.hostname"
}
]
}
}
The default.json that ships with powerline is buried in the innards of the Python package, the location of which depends on how you installed it, your Python version, and other things (e.g. mine is at ~/.virtualenv/default/lib/python2.7/site-packages/powerline/config_files/themes/tmux/default.json). You can copy that to the ~/.config path above and modify it to your liking, or just use what I pasted.

Related

R: How can I install a specific release by install_github()?

If the current version of a package, gives some errors, users may prefer to install a specific release (e.g. version 1.0.1). What kind of R code can be used to achieve that?
Take for example for the release of the latest OhdsiRTools R packages:
https://github.com/OHDSI/OhdsiRTools/tree/v1.0.1
The command something like:
install_github("OHDSI/OhdsiRTools", ref = 'v1.0.1')
The code above is not correct. It only works for branches (e.g., master or devA). But the devtools package has functions to refer to releases.
Ideally I would refer to releases by their tag (but solution with commit ID would work too).
EXTRA BONUS: What code can install "latest" release. (but consider this a bonus question. The question about is the main one)
You need to append tags for releases directly onto the name of the repository argument. So, username/repo#releasetag will work. Only use the parameter ref = "devA" when you need to refer to a specific branch of the git repository.
For your example, regarding OhdsiRTools v1.0.1, we have
we have:
devtools::install_github("OHDSI/OhdsiRTools#v1.0.1")
Edit
After toying around with devtools source, it has come to my attention that one can request the latest source with:
username/repo#*release
Hence, you could use:
devtools::install_github("OHDSI/OhdsiRTools#*release")
End Edit
Outdated, see edit
Unfortunately, to obtain the latest release tag, the work for that is a bit more complicated as it would involve parsing a response from the GitHub API. Here are some notes if you really do need the tagged version... You would have to parse JSON from:
https://api.github.com/repos/<user>/<repo>/releases/latest
using either RJSONIO, jsonlite, rjson
To extract "tag_name" from:
{
"url": "https://api.github.com/repos/OHDSI/OhdsiRTools/releases/2144150",
"assets_url": "https://api.github.com/repos/OHDSI/OhdsiRTools/releases/2144150/assets",
"upload_url": "https://uploads.github.com/repos/OHDSI/OhdsiRTools/releases/2144150/assets{?name,label}",
"html_url": "https://github.com/OHDSI/OhdsiRTools/releases/tag/v1.0.1",
"id": 2144150,
"tag_name": "v1.0.1",
"target_commitish": "master",
"name": "Minor bug fix",
"draft": false,
"author": {
"login": "schuemie",
"id": 6713328,
"avatar_url": "https://avatars.githubusercontent.com/u/6713328?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/schuemie",
"html_url": "https://github.com/schuemie",
"followers_url": "https://api.github.com/users/schuemie/followers",
"following_url": "https://api.github.com/users/schuemie/following{/other_user}",
"gists_url": "https://api.github.com/users/schuemie/gists{/gist_id}",
"starred_url": "https://api.github.com/users/schuemie/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/schuemie/subscriptions",
"organizations_url": "https://api.github.com/users/schuemie/orgs",
"repos_url": "https://api.github.com/users/schuemie/repos",
"events_url": "https://api.github.com/users/schuemie/events{/privacy}",
"received_events_url": "https://api.github.com/users/schuemie/received_events",
"type": "User",
"site_admin": false
},
"prerelease": false,
"created_at": "2015-11-18T00:55:28Z",
"published_at": "2015-11-18T06:35:57Z",
"assets": [
],
"tarball_url": "https://api.github.com/repos/OHDSI/OhdsiRTools/tarball/v1.0.1",
"zipball_url": "https://api.github.com/repos/OHDSI/OhdsiRTools/zipball/v1.0.1",
"body": "Fixed bug in `convertArgsToList ` function."
}
Above is taken from https://api.github.com/repos/OHDSI/OhdsiRTools/releases/latest
For anyone who arrives here looking for how to install from a specific commit SHA, it's simply:
remotes::install_github("username/repository#commitSHA")
Example
Look for the SHA for the commit you want to install from the 'commits' page on github:
In this case the commit SHA is: 8bc79ec6dd57f46f753cc073a3a50e0921825260, so simply:
remotes::install_github("wilkelab/ggtext#8bc79ec6dd57f46f753cc073a3a50e0921825260")

UNCSS keeps aborting with "src files were empty" message

I keep getting this error with UNCSS: 'Warning: Destination (dist/css/main.css) not written because src files were empty. Use --force to contine. Aborted due to warnings.
I believe it's running the task fine and is set up properly. I can use grunt for other things.
In gruntfile.js, I've included: grunt.loadNpmTasks('grunt-uncss');
and
uncss: {
dist: {
files: {
'dist/css/main2.css': ['../index.html']
}
}
}
I'm not sure what's wrong, but I think it's the pathing, but that's just how it is. I'm also using SCSS, so maybe it needs a raw css as SRC? I've tried reinstalling PhantomJS and the raw UNCSS without Grunt, but I'm going no where! Any ideas?
I found the solution.
It wasn't necessarily the pathing, but how the pathing was presented.
I was using
files: {
'dist/css/main2.css': ['../index.html']
}
I switched to
files: [
{ src: 'index.html', dest: 'dist/css/main.css' }
]
Here, the src & dest are declared.
This blog helped me deanhume.com.
The github/NPM documentation didn't work for me, but this guy's did. I hope this helps someone!

Using SuplimeREPL to run R

I'm using Sublime text 3, and I'm trying to get SublimeREPL to print R files output in the interactive mode that is already open, without reopen a new interactive session every time I modify the .r file and hit cmd + B
I followed sblair procedure for Python here and created R.sublime-build file with the following parameters:
{
"target": "run_existing_window_command",
"id": "repl_r",
"file": "config/R/Main.sublime-menu"
}
and modified a default line in Main.sublime-menu:
"osx": ["R", "--interactive", "--no-readline"]
into:
"osx": ["R", "--slave", "-f", "$file"]
Now every time I hit cmd + B, I get a new window, with the output by itself!
I couldn't figure out how to make the same window that runs the interactive session to print the output stay running
Note: I know that I can just switch to the prompt window and type >source("FILE")
every time I change something, but I want to know if there's a way as easy as making changes to .r file, hit some shortcut, voalla your output is in the same prompt window you were working on.
If i understand correctly..
Yep, there is, just bind "command": "repl_transfer_current", "args": {"scope": "file"} to a key and when you hit that key it will pass your current file to the REPL prompt for that file.
What i do, that is even better, i got:
{ "keys": ["super+r"], "command": "build" },
{ "keys": ["super+b"], "command": "repl_transfer_current", "args": {"scope": "file"} },
So i can build in the Sublime console with Cmd-R and in the REPL with Cmd-B.
Hope it helps!

Grunt - Command Line Arguments, not working

I am using command line options in my grunt script: http://kurst.co.uk/transfer/Gruntfile.js
However the command grunt --vers:0.0.1 always returns 'undefined' when I try to get the option:
var version = grunt.option('vers') || '';
Can you help me get this working ?
I tried different (CLI) commands:
grunt vers:asd
grunt -vers:asd
grunt vers=asd
as well as using :
grunt.option('-vers');
grunt.option('--vers');
But no luck so far. Hopefully I am missing something simple.
This is my package.js file:
{
"name": "",
"version": "0.1.0",
"description": "Kurst EventDispatcher / Docs Demo ",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-yuidoc": "*",
"grunt-typescript": "~0.1.3",
"uglify-js": "~2.3.5",
"grunt-lib-contrib": "~0.6.0",
"grunt-contrib-uglify":"*"
}
}
The proper syntax for specifying a command line argument in Grunt is:
grunt --option1=myValue
Then, in the grunt file you can access the value and print it like this:
console.log( grunt.option( "option1" ) );
Also, another reason you are probably having issues with --vers is because its already a grunt option that returns the version:
★ grunt --vers
grunt-cli v0.1.7
grunt v0.4.1
So it would probably be a good idea to switch to a different option name.
It is worth mentioning that as the amount of command line arguments you want to use grows, you will run into collisions with some arguments that grunt uses internally.
I got around this problem with nopt-grunt
From the Plugin author:
Grunt is awesome. Grunt's support for using additional command line options is not awesome. The current documentation is misleading in that they give examples of using boolean flags and options with values, but they don't tell you that it only works that way with a single option. Try and use more than one option and things fall apart quickly.
It's definitely worth checking out

How to pass a line to the console in sublime text 2 editor

I use RStudio for working with R programming language and find the ctrl+enter shortcut to send a line to the console extremely useful in troubleshooting my work.
Now I am using sublimetext2 and I would like to do the same thing in RStudio, send a line to the console.
Is there a way to send the existing line to the console or a SublimeREPL console?
I don't know about the console, but this is possible with SublimeREPL.
As long as you have a REPL and a file of the same language open at the same time, you can send a line (or a selection or file) to your open REPL via the SublimeREPL Source Buffer Keys. By default, Ctrl+, followed by l sends the current line to the REPL, but you can change the hotkey to Ctrl+Enter (in Python only, to protect other languages' default Ctrl+Enter functionality) by adding these lines to the top of your Preferences -> Key Bindings – User file:
{ "keys": ["ctrl+enter"], "command": "repl_transfer_current", "args": {"scope": "lines"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "source.python", "match_all": true }
]
},
Other available scopes (from Preferences -> Browse Packages -> SublimeREPL/Default (Windows).sublime-keymap) are selection, file, and block (Clojure only). If you want to send a line to your REPL but not parse it immediately, you can add "action":"view_write" to the args object, like so:
{ "keys": ["ctrl+enter"], "command": "repl_transfer_current", "args": {"scope": "lines", "action": "view_write"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "source.python", "match_all": true }
]
},
See the Unofficial Sublime Text 2 Docs for more information on key bindings.
In the case that the REPL is open in a different tab than your source (rather than a separate view), the source buffer hotkeys will not focus the REPL. I'm sure it's possible to implement some sort of tab-swapping toggle key, but that sounds like a problem for another question.
In addition to setting up your own key bindings, you can simply install Enhanced-R:
In Sublime:
Cmd + Shift + P (to bring up the command palette)
type "Install Package"
Navigate to Enhanced-R
If you are using Sublime for mostly just R, then you can set the default syntax for the whole app. Or you can change it per file (Cmd + Shift + P again, then start typing Syntax Enhanced R)
Then, like you are used to in RStudio, you simply hit Cmd + enter to ship the code to the Console or R.app etc
Sending raw R code to SublimeREPL does work now:
Bring up the Cmd/Ctrl+Shift+P menu
Select R Application Switch
Select SublimeREPL
When you have SublimeREPL active, you'll be able to send raw R to it with Cmd/Ctrl+Enter.
Note that by default, SublimeREPL won't display the code that gets sent in; it'll just show you the output. If you want to also see the code, you can change your user settings:
Navigate to Preferences -> Package settings -> SublimeREPL -> Settings - User
Turn on the show_transferred_text setting.
For example, if you don't have any other settings, your settings should look like this:
{
"show_transferred_text": true
}

Resources