Skip to content

Instantly share code, notes, and snippets.

View brighteyed's full-sized avatar

Sergey Kondrikov brighteyed

  • Russian Federation
View GitHub Profile
#!/usr/bin/env python
from github import Github # https://github.com/PyGithub/PyGithub
import requests
import json
import sys
import os
gitea_url = "http://127.0.0.1:3000/api/v1"
gitea_token = open(os.path.expanduser("~/.gitea-api")).read().strip()
#!/usr/bin/env python
from github import Github # pip install PyGithub
import json
import os
all = []
g = Github(open(os.path.expanduser("~/.gist")).read())
#!/usr/bin/env python
from github import Github # https://github.com/PyGithub/PyGithub
import json
import os
g = Github(open(os.path.expanduser("~/.gist")).read())
starred = []
for repo in g.get_user().get_starred():
@brighteyed
brighteyed / _vimrc
Last active February 21, 2020 12:01
Simple vim configuration file
" Set encoding
set fileencodings=ucs-bom,utf-8,default
set fileencoding=utf-8
set encoding=utf-8
" Turn on line numbers and linebreak
set linebreak
set number
" Set color schema and syntax highlighting
@brighteyed
brighteyed / permutations.py
Created September 19, 2020 06:11
Returns all permutations of a given list
def permutations(lst):
count = len(lst)
if count == 0:
yield lst
for i in range(count):
for l in permutations(lst[:i] + lst[i+1:]):
yield [lst[i]] + l
@brighteyed
brighteyed / github_starred.sh
Last active June 13, 2022 19:54
Get random starred repo for github user
#!/bin/bash
USER=${1:-brighteyed}
STARS=$(curl -is "https://api.github.com/users/$USER/starred?per_page=1" | egrep -i '^Link' | egrep -o 'page=[0-9]+' | tail -1 | cut -d= -f2)
echo "$STARS starred repos found for $USER"
REPO=$(shuf -i1-$STARS -n1)
URL=$(curl -s "https://api.github.com/users/$USER/starred?per_page=1&page=$REPO" | jq '.[]|{html_url}' | jq --raw-output '.[]')