Pushbots why I need to give the platform? - phonegap-plugins

I use pushbots for notification in my app. I am using cordova.
I looked at the api and they required the platform number 0 for iphone and 1 for android.
Why I need to give them the platform? in the site their is the list of the tokens with the platforms so they already know the platform.
can I give them some another value for android and also for iphone? or to send twice, one time with 0 and on time with 1?

According to this page in the docs: https://pushbots.com/developer/docs/api-batch_push - you CAN provide multiple platform numbers as an array:
0 for iOS.
1 for Android.
2 for Chrome
e.g. [0,1] to push to Android and iOS.
And then again later in their curl example, you can see that platform is an Array:
curl -X POST \
-H "x-pushbots-appid: 54cc0a511d0ab13c0528b459d" \
-H "x-pushbots-secret: 1444fe8be3324ff7128f25aa18cdee12" \
-H "Content-Type: application/json" \
-d '{ "platform" : Array , "tags" : Array , "sound" : String , "badge" : String , "schedule" : String , "except_tags" : Array , "alias" : String , "except_alias" : String , "payload" : JSON , }' \
https://api.pushbots.com/push/all

Related

Aria2c always add to queue a new parallel download when one finishes

I'm working on a bash script where I use aria2c with --max-concurrent-downloads to parallel download files from a list --input-file.
Like this:
08/05 11:45:05 [NOTICE] Downloading 5 item(s)
[#25487f 3.4MiB/112MiB(3%)][#b99e01 9.5MiB/39MiB(23%)][#e0ce70 3.2MiB/909MiB(0%)][#06633c 2.9MiB/800MiB(0%)][#a450d5 2.1MiB/17GiB(0%)]
The problem is that I have to wait for all the 5 files to finish downloading in order to loop again and download other 5 files.
And if one of the files is huge there is a bottleneck:
[#a450d5 14GiB/17GiB(83%) CN:1 DL:7.8MiB ETA:6m19s]
So is there any way to begin a new download when one finishes? To always have 5 files downloading all the time.
This is the code:
#!/bin/bash
#before this there is more logic, but it is not relevant here.
#/mnt/k/dl/${NAME}/${NAME}.txt is a list of IDs like this:
#29356176 29356744 29360752 29488484 29488703 29507184 29567654 29576218 29658504
VID_IDS=$(cat /mnt/k/dl/${NAME}/${NAME}.txt)
eval "VID_IDS=($VID_IDS)"
n=5
#loop every 5 IDs from the .txt list
for (( i = 0; i <= "${#VID_IDS[#]}"; i += n )); do
#delete --input-file for aria on every loop
rm -r /mnt/k/dl/${NAME}/aria_${NAME}.txt
TEMP=("${VID_IDS[#]:i:n}")
VIDSGROUP=${TEMP[*]}
for VIDEO_ID in $VIDSGROUP; do
#Logic to get a valid download link: $VIDEO_LINK. Not relevant here.
#build the --input-file for aria
echo $VIDEO_LINK >> /mnt/k/dl/${NAME}/aria_${NAME}.txt
done
DOWNLOADDIR="/mnt/k/dl/${NAME}"
ARIAFILELIST="/mnt/k/dl/${NAME}/aria_${NAME}.txt"
aria2c --check-certificate=false \
--max-file-not-found=10 \
--retry-wait=5 \
--max-tries=10 \
--max-connection-per-server=5 \
--max-concurrent-downloads=5 \
--allow-overwrite=false \
-c \
--dir=$DOWNLOADDIR \
--input-file=$ARIAFILELIST
done

How do I display icons in VIM

I'm looking to set up vim to display icons in my NerdTree pane.
I have it set as:
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
It would be similar to how VSCode is set.
Which display correctly here but not in my terminal it just has [x].
Is there a setting I can change?
I'm trying to set it up so that each file type has its own icon and git status for the file is visually shown.
I ended up installing a nerd font and airline now everything works.
I recommend using vim-devicons

Vim markdown navigation with ctags: using 'tagbar' + 'markdown2ctags' with 'vim-pandoc'

All,
I'd like to be able to use the Vim Tagbar plugin with markdown2ctags to navigate my markdown files.
I haven't been able to automatically generate the tags file because the filetype, per :set filetype? is currently set to pandoc. That's becaue I have the the vim-pandoc plugin installed. However, if I change the filtype to markdown everything works.
I have control over two items: my ~/.vimrc file and my ~/.ctags file. Does anyone have an idea of how things should be set? I've tried changing markdown to pandoc in the excerpts below, but that didn't help.
Edit: As per the comment by #IngoKarkat, because markdown2ctags is handling the creation of my tags file, the .ctags settings are irrelevant.
From my ~/.vimrc file... (set as per the Tagbar instructions for markdown files)
let g:tagbar_type_markdown = {
\ 'ctagstype': 'markdown',
\ 'ctagsbin' : '~/.vim/plugged/markdown2ctags/markdown2ctags.py',
\ 'ctagsargs' : '-f - --sort=yes --sro=»',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '»',
\ 'kind2scope' : {
\ 's' : 'section',
\ },
\ 'sort': 0
\ }
...and my ~/.ctags file (Edit: Unused, but still including)
--langdef=markdown
--langmap=markdown:.mkd
--regex-markdown=/^#[ \t]+(.*)/\1/h,Heading_L1/
--regex-markdown=/^##[ \t]+(.*)/\1/i,Heading_L2/
--regex-markdown=/^###[ \t]+(.*)/\1/k,Heading_L3/
Thanks,
Sean
I found a few solutions to the problem. I've listed them here in case someone finds them useful.
Solution 1: Re-define the pandoc filetype to the markdown filetype
I looked at the vim-pandoc pandoc.txt file and the solution was there. The relevant information:
To enable pandoc functionality for markdown files while using the markdown
filetype and syntax, use
>
let g:pandoc#filetypes#handled = ["pandoc", "markdown"]
let g:pandoc#filetypes#pandoc_markdown = 0
Note: vim-pandoc's developers mostly use pandoc's markdown syntax, so
coverage for it is more complete than for the other filetypes.
With the filetype now correctly set, everything works. The ~/.vimrc should be (with appropriate substitution for your own ctagsbin path):
let g:pandoc#filetypes#handled = ["pandoc", "markdown"]
let g:pandoc#filetypes#pandoc_markdown = 0
let g:tagbar_type_markdown = {
\ 'ctagstype': 'markdown',
\ 'ctagsbin' : '~/.vim/plugged/markdown2ctags/markdown2ctags.py',
\ 'ctagsargs' : '-f - --sort=yes --sro=»',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '»',
\ 'kind2scope' : {
\ 's' : 'section',
\ },
\ 'sort': 0
\ }
Solution 2: Define a new pandoc tagbar type
Add the following to your ~/.vimrc
let g:tagbar_type_pandoc = {
\ 'ctagstype': 'pandoc',
\ 'ctagsbin' : '~/.vim/plugged/markdown2ctags/markdown2ctags.py',
\ 'ctagsargs' : '-f - --sort=yes --sro=»',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '»',
\ 'kind2scope' : {
\ 's' : 'section',
\ },
\ 'sort': 0
\ }
Everything should work! This is my preferred solution.
Solution 3: Use the builtin pandoc :TOC command.
The vim-pandoc :TOC command produces a navigational menu, however, I don't like it as well as the sidebar tagbar menus. But it is a built in default.

Replacing a string with a variable in a cURL command [duplicate]

This question already has answers here:
Expansion of variables inside single quotes in a command in Bash
(8 answers)
Closed 5 years ago.
I am trying to automate a GroupMe bot as simply as possible. An easy way to send a message from the command line is to use the following command:
curl -d '{"text" : "Your message here", "bot_id" : "this_is_a_secret_string"}' https://api.groupme.com/v3/bots/post
In a Shell script, I would like to replace "Your message here" with var, in which var is being set to the output from a different command. Is this possible?
Things I have replaced "Your message here" with that did not work:
var
$var
(var)
$(var)
{var}
${var}
Anything put within double quotes ("") is treated as a String, so did not try much in those regards.
The var will not be evaluated because it's w/in single quotes. One way around this is to just smash 3 strings together:
curl -d '{"text" : "'"$var"'Your message here", "bot_id" : "this_is_a_secret_string"}' https://api.groupme.com/v3/bots/post
string 1: '{"text" : "'
string 2: "$var"
string 3: 'Your message here", "bot_id" : "this_is_a_secret_string"}'
NOTE: this will only work if the contents of var are very simple. The expanded string must still be a valid JSON string.

Systemverilog Support in tagbar plugin

can anybody help me to add systemverilog language support in tagbar vim plugin.
I tried below things but its doesnt worked for me
1) Created ~/.ctags and copy code from https://github.com/shaohao/config.d/blob/master/ctags
2) mkdir ftplugin to ~/.vim and add systemverilog.vim from https://github.com/shaohao/vimfiles/blob/master/bundle/verilog_systemverilog/ftplugin/systemverilog.vim
3)cd to project directory and run ctags -R *
Got below warning though
ctags: Warning: Unknown language specified in "langmap" option
Below are some output of ctags
ctags --list-languages
ctags: Warning: Unknown language specified in "langmap" option
.
.
systemverilog
ctags --list-kinds=systemverilog
ctags: Warning: Unknown language specified in "langmap" option
e clocking
i constraint
l covergroup
o class
t function
A interface
G module
J package
M program
W task
But still when i open SV file in gvim and use :TagbarToggle tagbar window is blank :(
Please help
I've introduced some improvements to the verilog_systemverilog vim plugin that I made available at Github. You should have proper Tagbar support if you use this development version of exuberante-ctags together with my vim plugin and the following Tagbar configuration:
let g:tagbar_type_verilog_systemverilog = {
\ 'ctagstype' : 'SystemVerilog',
\ 'kinds' : [
\ 'b:blocks:1:1',
\ 'c:constants:1:0',
\ 'e:events:1:0',
\ 'f:functions:1:1',
\ 'm:modules:0:1',
\ 'n:nets:1:0',
\ 'p:ports:1:0',
\ 'r:registers:1:0',
\ 't:tasks:1:1',
\ 'A:assertions:1:1',
\ 'C:classes:0:1',
\ 'V:covergroups:0:1',
\ 'I:interfaces:0:1',
\ 'M:modport:0:1',
\ 'K:packages:0:1',
\ 'P:programs:0:1',
\ 'R:properties:0:1',
\ 'T:typedefs:0:1'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 'm' : 'module',
\ 'b' : 'block',
\ 't' : 'task',
\ 'f' : 'function',
\ 'C' : 'class',
\ 'V' : 'covergroup',
\ 'I' : 'interface',
\ 'K' : 'package',
\ 'P' : 'program',
\ 'R' : 'property'
\ },
\ }
Background: TagBar won't use your tags file, it queries ctags and read its output directly from stdout.
I believe the problem is how the --langmap is defined in your ~/.ctags. AFAIK, the coma is used to separate langmaps while different extensions are just put one after the other without separators:
--langmap=foo:.foo.fo.oo,bar:.bar.ba
I think line 2 of your ~/.ctags file should look like this:
--langmap=systemverilog:.sv.svh.svp

Resources