Skip to content

Instantly share code, notes, and snippets.

View edwindotcom's full-sized avatar
:octocat:
hubba hubba

Edwin Wong edwindotcom

:octocat:
hubba hubba
  • Alameda, CA
View GitHub Profile
@edwindotcom
edwindotcom / gist:17005f658976a552905f013183ba1db3
Last active September 21, 2020 22:43
github gql - search by most stars
query SearchMostTop10Star($queryString: String!, $number_of_repos:Int!) {
search(query: $queryString, type: REPOSITORY, first: $number_of_repos) {
repositoryCount
edges {
node {
... on Repository {
name
url
description
stargazers {totalCount}
@edwindotcom
edwindotcom / getMyRepos.gql
Last active September 21, 2020 22:33
github graphql - get logged in users repos
{
viewer {
repositories(first: 10) {
totalCount
nodes {
name
url
nameWithOwner
}
curl \
-H "Authorization: token TOKEN" \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/github/service-catalog-demo/deployments \
-d '{"ref":"master", "environment":"amy-dev-svr"}'
curl -H "Authorization: token TOKEN" \
-H 'Accept: application/vnd.github.v3+json' \
"https://api.github.com/repos/github/service-catalog-demo/dispatches" \
-d '{"event_type": "trigger", "client_payload": {"filename": "2020-08-11-foo123", "title": "Hi Mom", "status": "Major outage"}}'
@edwindotcom
edwindotcom / convert.py
Created June 5, 2020 16:41
convert inches to foot-inches
import sys
import math
def inch_to_ft_inch(inches):
ft = math.floor(int(inches)/12)
ret_inch = int(inches) % 12
return ft, ret_inch
val = inch_to_ft_inch(sys.argv[1])
print("{}\' {}\"".format(int(val[0]), val[1]))
# Renames all the files in a directory with the root filename
# To run this:
# $ python pymv.py MyFileNameRoot
# > Renaming: Screen Shot 2020-04-23 at 10.07.21 AM.png => flare0.png
import os
import sys
# Function to rename multiple files
def main():
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
git push origin `git subtree split --prefix public master`:gh-pages --force
# usage - run:
# python getTitle.py URL
from urllib2 import urlopen
import sched, time
from time import gmtime, strftime
import lxml.html
import sys
url = sys.argv[1]
### Keybase proof
I hereby claim:
* I am edwindotcom on github.
* I am edwindotcom (https://keybase.io/edwindotcom) on keybase.
* I have a public key ASB7cNwde-yx-Syxd1bYlQIB3jibATDBLhPGuQ0UUHOiiQo
To claim this, I am signing this object: