Bash script - cygwin (powershell?) pull from GitHub API Parse JSON
All,
Have a weird issue where i need to generate a report from GitHub monthly detailing user accounts and the last time they logged in. I'm using a windows box to do this (work issued) and would like to know if anyone has any experience scripting for GitAPI using windows / cygwin / powershell?
I would normally curl for the stuff i wanted and use jsawk to parse the returned JSON, but that's not working (and i don't see an option to add jsawk to Cygwin) so i'm at a loss: Any help greatly appreciated.
Edit: thought i would add that the code block below is working except for the 'jsawk' operation. I was just including that as an example of how i would do this in a real terminal.
Last edited by ChocoTaco; 08-20-2014 at 07:23 PM..
Hi, all,
I try to run a quite simple bash script mytest.sh in cygwin, it's content is:
#!/bin/bash
echo "It is my first bash shell"
there are three lines in the script. The second line is blank line.
When I run it use command: bash c:/mytest.sh, ... (6 Replies)
Hi
I wish to "develop" for brew. It is hosted on GitHub. What book (or online documentation) do you recommend me for GitHub and/or Git?
Prefer small physical book. (1 Reply)
I would like to the the windws8/cygwin/bash shebang feature to start a powershell script.
I do a "chmod +x set-sound.ps1"
and then at a bash prompt I do
./set-sound.ps1
The first line of ./set-sound.ps1
#!powershell.exe -ExecutionPolicy unrestricted
The result is the result:
... (5 Replies)
Hello,
I would like to modify an existing script of mine that uses a manually defined "MCVERSION" variable and make it define that variable instead based on this JSON file stored online:
https://s3.amazonaws.com/Minecraft.Download/versions/versions.json
Within that JSON, I 'm looking for... (4 Replies)
Hello All,
I need help writing a bash script that will run on 500 LINUX servers and do the following:
1. Capture the ipa_server name from /etc/sssd/sssd.conf on a list of 500 servers in the ipahosts file.
2. Write to a file outputing only server name and IPA server name.
Root ssh keys... (3 Replies)
I am trying to automate editing of a json file using bash script.
The file I initially receive is
{
"appMap": {
"URL1": {
"name": "a"
},
"URL2": {
"name": "b"
},
"URL3": {
"name": "c"
},
}
WHat I would like to do is replace... (5 Replies)
Hello Experts,
I am creating a run time powershell script on Linux machine and copying that powershell script to Windows machine. To connect to windows through "ssh", I am using Cygwin tool. To make the connection password less I copied my public in authorized_keys in windows Administrator... (5 Replies)
Hello.
I'm new to bash script and I'm learning the basics by writing some scripts.
Recently a friend of mine asked me if I could try to write a script to him to automate a couple of processes that uses JSON RPCs.
I'll try to explain in few words the workflow just to contextualize the problem.... (48 Replies)
Hello All,
Greetings..
I have a json file that I need to pase its URLs and other values.
The match should start with "notifications" and output URLs and settings values.
I tried with python or awk but hardly could get URLs only. Or whole URLs from full json file. Could not match... (2 Replies)
Discussion started by: 7adi
2 Replies
LEARN ABOUT DEBIAN
net::github::v3
Net::GitHub::V3(3pm) User Contributed Perl Documentation Net::GitHub::V3(3pm)NAME
Net::GitHub::V3 - Github API v3
SYNOPSIS
Prefer:
use Net::GitHub;
my $gh = Net::GitHub->new(
version => 3,
login => 'fayland', pass => 'mypass',
# or
# access_token => $oauth_token
);
Or:
use Net::GitHub::V3;
my $gh = Net::GitHub::V3->new(
login => 'fayland', pass => 'mypass',
# or
# access_token => $oauth_token
);
DESCRIPTION
<http://develop.github.com/>
ATTRIBUTES
Authentication
There are two ways to authenticate through GitHub API v3:
login/pass
my $gh = Net::GitHub::V3->new( login => $ENV{GITHUB_USER}, pass => $ENV{GITHUB_PASS} );
access_token
my $gh = Net::GitHub->new( access_token => $ENV{GITHUB_ACCESS_TOKEN} );
raw_response
my $gh = Net::GitHub->new(
# login/pass or access_token
raw_response => 1
);
return raw HTTP::Response object
raw_string
my $gh = Net::GitHub->new(
# login/pass or access_token
raw_string => 1
);
return HTTP::Response response content as string
api_throttle
my $gh = Net::GitHub->new(
# login/pass or access_token
api_throttle => 0
);
To disable call rate limiting (e.g. if your account is whitelisted), set api_throttle to 0.
RaiseError
By default, error responses are propagated to the user as they are received from the API. By switching RaiseError on you can make the be
turned into exceptions instead, so that you don't have to check for error response after every call.
next_url, last_url, prev_url, first_url
Any methods which return multiple results may be paginated. After performing a query you should check to see if there are more results.
These attributes will be reset for each query.
The predicates to check these attributes are "has_next_page", "has_last_page", "has_prev_page" and "has_first_page".
See Github's documentation: <http://developer.github.com/v3/#pagination>
The "per_page" parameter mentioned in their docs is NOT supported by this module.
my @issues = $gh->issue->repos_issues;
while ($gh->issue->has_next_page) {
push @issues, $gh->issue->query($gh->issue->next_url);
## OR ##
push @issues, $gh->issue->next_page);
}
METHODS
query($method, $url, $data)
my $data = $gh->query('/user');
$gh->query('PATCH', '/user', $data);
$gh->query('DELETE', '/user/emails', [ 'myemail@somewhere.com' ]);
query API directly
next_page
When the results have been paginated, "next_page" is sugar for the common case of iterating through all the pages in order. It simply calls
"query" with the "next_url".
set_default_user_repo
$gh->set_default_user_repo('fayland', 'perl-net-github'); # take effects for all $gh->
$gh->repos->set_default_user_repo('fayland', 'perl-net-github'); # take effects on $gh->repos
To ease the keyboard, we provided two ways to call any method which starts with :user/:repo
1. SET user/repos before call methods below
$gh->set_default_user_repo('fayland', 'perl-net-github');
my @contributors = $gh->repos->contributors;
2. If it is just for once, we can pass :user, :repo before any arguments
my @contributors = $repos->contributors($user, $repo);
MODULES
user
my $user = $gh->user->show('nothingmuch');
$gh->user->update( bio => 'Just Another Perl Programmer' );
Net::GitHub::V3::Users
repos
my @repos = $gh->repos->list;
my $rp = $gh->repos->create( {
"name" => "Hello-World",
"description" => "This is your first repo",
"homepage" => "https://github.com"
} );
Net::GitHub::V3::Repos
issue
my @issues = $gh->issue->issues();
my $issue = $gh->issue->issue($issue_id);
Net::GitHub::V3::Issues
pull_request
my @pulls = $gh->pull_request->pulls();
Net::GitHub::V3::PullRequests
org
my @orgs = $gh->org->orgs;
Net::GitHub::V3::Orgs
git_data
Net::GitHub::V3::GitData
gist
Net::GitHub::V3::Gists
oauth
Net::GitHub::V3::OAuth
event
Net::GitHub::V3::Events
SEE ALSO
Any::Moose, Pithub
AUTHOR & COPYRIGHT & LICENSE
Refer Net::GitHub
perl v5.14.2 2012-05-03 Net::GitHub::V3(3pm)