Skip to content

Instantly share code, notes, and snippets.

View poa00's full-sized avatar

Peter Abbasi poa00

  • Chicago
  • 07:14 (UTC -05:00)
View GitHub Profile
@poa00
poa00 / gh-dl-release
Created July 22, 2024 12:04 — forked from FabrizioCafolla/gh-dl-release
Download assets from private or public Github releases
#!/usr/bin/env bash
#
# This script downloads an asset from latest or specific Github release of a
# public or private repo.
#
# PREREQUISITES:
#
# curl, wget, jq
#
set -eE -o functrace
@poa00
poa00 / colors.sh
Created July 22, 2024 11:30 — forked from kennethreitz/colors.sh
Bash foreground ANSI terminal colors script.
#!/usr/bin/env bash
function bake_fg_color {
BLACK="\033[0;30m"
BLACK_BOLD="\033[1;30m"
WHITE="\033[0;37m"
WHITE_BOLD="\033[1;37m"
RED="\033[0;31m"
RED_BOLD="\033[1;31m"
GREEN="\033[0;32m"
@poa00
poa00 / sync.py
Created July 22, 2024 11:24 — forked from kennethreitz/sync.py
GitHub Syncer. Clones or Pulls all GitHub repos (including watched list).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Kenneth Reitz's GitHub Syncer
This script uses the GitHub API to get a list of all forked, mirrored, public, and
private repos in your GitHub account. If the repo already exists locally, it will
update it via git-pull. Otherwise, it will properly clone the repo.
It will organize your repos into the following directory structure:
@poa00
poa00 / mirror_setup.sh
Created July 22, 2024 11:23 — forked from peterjc/mirror_setup.sh
Script to simplify setting up git repository for cron-based mirroring of a GitHub fork
#!/bin/bash
set -euo pipefail
# See https://blastedbio.blogspot.co.uk/2016/05/sync-github-mirror-with-cron.html and
# https://gist.github.com/peterjc/eccac1942a9709993040425d33680352 for mirroring script
#
# Usage:
#
# 1. Fork upstream repo under HuttonICS, disable wiki, projects, issues etc. Protect master branch.
# 2. Run:
@poa00
poa00 / on_the_wall.py
Created July 22, 2024 11:21 — forked from peterjc/on_the_wall.py
Python script to keep GitHub mirrors in sync with upstream.
#!/usr/bin/env python
# Copyright 2021-2024 by Peter Cock, The James Hutton Institute.
# All rights reserved.
# This file is released under the "MIT License Agreement".
"""Python script to keep GitHub mirrors in sync with upstream.
Mirror mirror on the wall, who's the newest of them all?
Usage:
@poa00
poa00 / nginx.conf
Created July 22, 2024 11:19 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@poa00
poa00 / main_windows.go
Created July 22, 2024 11:17 — forked from petemoore/main_windows.go
Running process as interactive user from windows service with UAC process elevation
package main
import (
"context"
"errors"
"fmt"
"log"
"os"
"os/exec"
"syscall"
@poa00
poa00 / allrepos
Created July 22, 2024 11:08 — forked from pcapriotti/allrepos
List all personal repositories from git hosting services
#!/bin/bash
set -e
usage() {
echo "Usage: $0 USERNAME" 2>&1
exit 1
}
username="$1"
[ -z "$username" ] && usage
@poa00
poa00 / git-list-all-repos.py
Created July 22, 2024 11:04 — forked from mohnkhan/git-list-all-repos.py
List all repositories in git/user
#!/usr/bin/env python2.7
""" Print all of the (git/ssh or http) urls for all repos (public or
private+public with personal_token) in a GitHub account (user or organization).
Usage example::
[HTTP_URLS=1] python2.7 list-all-repos.py account_name [personal_token]
It requires the pygithub3 module, which you can install on macos (Mac OSX) like this::
# get pip if you don't have it
@poa00
poa00 / logger.ps1
Created July 22, 2024 04:31 — forked from barsv/logger.ps1
Logging in powershell with log rotation
# all logging settins are here on top
$logFile = "log-$(gc env:computername).log"
$logLevel = "DEBUG" # ("DEBUG","INFO","WARN","ERROR","FATAL")
$logSize = 1mb # 30kb
$logCount = 10
# end of settings
function Write-Log-Line ($line) {
Add-Content $logFile -Value $Line
Write-Host $Line