Skip to content

Instantly share code, notes, and snippets.

@CodeBySwati
Created January 11, 2024 12:13
Show Gist options
  • Save CodeBySwati/69656286d4c80fdeba9c416c319d10f7 to your computer and use it in GitHub Desktop.
Save CodeBySwati/69656286d4c80fdeba9c416c319d10f7 to your computer and use it in GitHub Desktop.
Gist update script
#!/usr/bin/perl5.12.4
use JSON;
use LWP::Simple;
use Cwd;
my $data = get "http://gist.github.com/api/v1/json/gists/damianzaremba";
my $json = decode_json($data);
my $gists = $json->{"gists"};
for my $gist (@$gists) {
my $name = $gist->{'repo'} . ' - ' . $gist->{'description'};
print "Getting: " . $name . "\n";
if( -d $name ) {
chdir($name);
qx(git pull);
chdir("../");
} else {
my $repo_url = 'ssh://[email protected]:22/' . $gist->{'repo'} . '.git';
$name =~ s/"/\\"/g;
qx(git clone '$repo_url' "$name");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment