Getting names of all private repos through GitHub API - api

I'm trying to get a list of all names in a repo that I have access to. I tried running:
curl -u username:pw -X GET https://api.github.com/orgs/org_name/repos?per_page=100 >> list.txt
but I get the error: zsh: no matches found: https://api.github.com/org/org_name/repos?per_page=100
All I want is a list of the repos... no other information. Can't seem to figure it out. I'm new to programming and started using API like.. 1 hour ago? Any advice would be helpful.

Your shell (zsh) is interpreting the URL as a path and complaining because it doesn't match any files. You can solve this by placing quotes around it. In this case, either single or double quotes will work.

Related

Access Token Curl

On this website:
https://developers.google.com/nest/device-access/authorize
Under Get Access Token
It says "Open a terminal and run the following curl command, replacing oauth2-client-id and oauth2-client-secret with the OAuth2 Client ID and Client Secret from your GCP Credentials, and authorization-code with the code you receive in the previous step:"
I have repeatedly input my oauth2-client-id, oauth2-client-secret and authorization-code. I copy and paste into the Terminal in Raspbian. It always says "Curl(3) URL using bad/illegal format or missing URL". Because I am copying and pasting all my information into the syntax, then copying and pasting the syntax into Terminal, I am at a complete loss for how to proceed.
Is something wrong with the Syntax that this Google document provided?
Google's recommended syntax is shown in the image and on the website I gave a link to.
enter image description here
.... made some progress here.
Rather than utilising the copy-code from Google, directly from the page, I copied and pasted onto "TextMate" and joined the 5 rows command into a single row.
I basically went at the beginning of each row (in TextMate) and backspace'd to the previous row, until the command was a single line one.
I then copied the single line command and pasted it into Terminal.
This is removing the previous error, at least the command is going through, I get most of the responses from the server.
I am still getting an error, which I am trying to figure out: "error" : "unsupported_grant_type".
The command includes "... grant_type=authorization_code..." within the command.

Running into issues with importing multiple CSV's into different collections using Keen's Command Line Interface

I have no problem importing one CSV file into a collection by using the keen-cli command
keen events:add -p xxxxxx -k xxxxxx -w xxxxxx -r xxxxxx --collection xxxxx --file xxxxxx.csv --csv
With -p, -k, -w, -r being key overrides to avoid installing dotenv and having to mess with an .env file.
This import works fine the first time until I try to repeat this with a different file and a different collection. By goal is to be able to compare both collections so I want to keep them in the same project but I always get the following error.
/Library/Ruby/Gems/2.0.0/gems/keen-cli-0.2.3/lib/keen-cli.rb:16:in `deep_merge': undefined method `keys' for "15:53:30":String (NoMethodError)
I know Keen allows for multiple collections in the same project so I'm not 100% sure what's going on here.
If one file is working and a seemingly identical file isn't working, try inspecting the not-working file for:
misc or missing spaces, commas, and carriage returns at the end of the text
misc or missing spaces, commas, and carriage returns at the end of lines
Figured it out!
Keen assumes that whatever your first column is will act as your unique key for the collection.
If there is any missing values in that list the entire thing fails.

How to extract the strings in double quotes for localization

I'm trying to extract the strings for localization. There are so many files where some of the strings are tagged as NSLocalizedStrings, and some of them are not.
I'm able to grab the NSLocalizedStrings using ibtool and genstrings, but I'm unable to extract the plain strings without NSLocalizedString.
I'm not good at regex, but I came up with this "[^(]#\""
and with the help of grep:
grep -i -r -I "[^(]#\"" * > out.txt
It worked, and all the strings were actually grabbed into a txt file, but the problem is ,
if in my code there is a line:
..... initWithTitle:#"New Sketch".....
I only expect the grep to grab the #"New Sketch" part, but it grabs the whole line.
So in the out.txt file, I see initWithTitle:#"New Sketch", along with some unwanted lines.
How can I write the regex to grab only the strings in double quotes ?
I tried the grep command with the regex mentioned in here, but it gave me syntax error .
For ex, I tried:
grep -i -r -I (["'])(?:(?=(\\?))\2.)*?\1 * > out.txt
and it gave me
-bash: syntax error near unexpected token `('
In xcode, open your project. Go to Editor->Export For Localization...It will create the folder of files. Everything that was marked for localization will be extracted there. No need to parse it yourself. It will be in the XML format.
If you wanna go hard way, you can then parse those files the way you're trying to do it now ?! It will also have Storyboard strings there too, btw.

cronjob not working, but working in browser

So I have this weird behaviour:
A customers runs an oxid-shop. He bought a module and in its documentation, it stated:
Add 3 cronjobs: < url >
So, nothing too special so far. I tried it in the browser and everything worked fine. My output was:
Convert complete! 0 articles. File: google.xml
So the Script seems to work. Then I tried to combine it with a cronjob.
*/02 * * * * curl http://www.example.org/index.php?cl=param1&fnc=param2&rto=param3
as you can tell, a complete valid url (no special chars or something like this in the vars)
However, the output is the following:
Warning: Smarty error: unable to read resource: "" in /usr/www/users/.../www2/core/smarty/Smarty.class.php on line 1094
I also tried it with lynx -dump URL. Same output. I can't modify the script, since it is encrypted.
Any idea what I could try? Might the be due to the params?
Tried it on 2 different servers with the same outcome.
The problem could in deed be that there are parameters in your URL.
When using [] or {} sequences when invoked from a command line prompt,
you probably have to put the full URL within double quotes to avoid
the shell from interfering with it. This also goes for other
characters treated special, like for example '&', '?' and '*'.
Source: https://curl.haxx.se/docs/manpage.html
So you should try to enclose your URL with double quotes.

How do I add a heroku deployhook:email using API?

I have been able to add a deployhook (for email and IRC) using the heroku cli (sdk). I would like to be able to add or update the email values (receipient etc) using the API. Is this possible? When I try to curl request to add a hook I get an error message noting the need for extra data: receipient, body, etc.
You can find a bit more detail about the different arguments here: https://devcenter.heroku.com/articles/deploy-hooks#email
Once you know what values you want/need you should be able to send it using this:
curl -n -g -X POST 'https://api.heroku.com/apps/MYAPP/addons/deployhooks%3Aemail?config[recipient]=me#example.com&config[subject]="MYAPP%20Deployed"&config[body]="{{user}}%20deployed%20app"'
The arguments:
-n reads credentials from netrc (this should be set by the toolbelt/cli)
-g tells it to not try and interpret the [] and {} in the url
-X POST sets it to be a POST rather than get request
Beyond that it was just a matter of encoding the params properly. I believe of those values recipient is the only required value (and the others have reasonable defaults).
You can only have one deployhook per type and they don't appear to allow updates. So if you need to change it, you'll want to remove the old one and then add another with the updated attributes. You can remove the old one like this:
curl -n -X DELETE 'https://api.heroku.com/apps/MYAPP/addons/deployhooks%3Aemail'