Skip to content

Instantly share code, notes, and snippets.

View andrewp-as-is's full-sized avatar
🔍

Andrew P andrewp-as-is

🔍
View GitHub Profile
@andrewp-as-is
andrewp-as-is / docker-stop-all-containers.sh
Last active October 12, 2021 19:45
Docker stop all containers #docker
sudo docker ps -q | xargs -r sudo docker stop
@mmillar-bolis
mmillar-bolis / Launchctl_Unload-10.14.sh
Created November 23, 2020 07:46
A Quick Little Script to Force Disable Certain LaunchDaemons in macOS
#!/bin/bash
# I have managed to map out some undesirable daemons and agents. Most of these
# can be disabled without too much consequence.
## Daemons
# com.apple.analyticsd - Anonymized application analytics daemon
# com.apple.appleseed.fbahelperd - Feedback Assistant Helper Daemon
# com.apple.awacsd - Apple Wide Area Connectivity Service Daemon
# com.apple.backupd - Apple TimeMachine service
@andrewp-as-is
andrewp-as-is / Docker base image.sh
Last active October 11, 2021 08:45
Docker base image
sudo docker login --username username
# Dockerfile required
sudo docker build -t username/python:3.8-alpine-psycopg2 .
sudo docker push username/python:3.8-alpine-psycopg2
@spacelatte
spacelatte / gists.graphql
Last active August 28, 2023 11:48
github api v4 gists query graphql
query gistquery($name: String = "pvtmert", $count: Int = 100, $field: GistOrderField = UPDATED_AT, $sort: OrderDirection = DESC, $privacy: GistPrivacy = ALL) {
user(login: $name) {
gists(first: $count, orderBy: {field: $field, direction: $sort}, privacy: $privacy) {
nodes {
name
owner {
id
login
url
resourcePath
@andrewp-as-is
andrewp-as-is / networksetup.sh
Last active October 14, 2021 10:56
macOS Wi-Fi #macos
/usr/sbin/networksetup -getairportpower en1 # On/Off
/usr/sbin/networksetup -getairportpower en1 | grep -iq "On"
# /usr/sbin/networksetup -setairportpower en0 on
# /usr/sbin/networksetup -setairportpower en0 off
export PATH="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources":$PATH
airport -s
@jamesluberda
jamesluberda / graphql-for-gists.md
Created June 20, 2018 01:07
Simple User Gists Query Using GitHub GraphQL API (v4 API)

I couldn't find any examples of gists queries using GraphQL--most GraphQL examples seem to focus on traditional repositories--so here is one. As a preface, I cannot recommend strongly enough, at least when getting started, developing queries using the GitHub GraphQL Explorer. I initially started by issuing queries via curl, constructing them using the docs available on the site and a downloaded copy of the schema. Unfortunately, I ended up with errors that I couldn't quite parse. I knew, for example, from the schema, the possible field values for ordering gists. However, whenever I tried to use one of those values, the API returned that it was invalid, like so:

{"data":null,"errors":[{"message":"Argument 'orderBy' on Field 'gists' has an invalid value. Expected type 'GistOrder'.","locations":[{"line":1,"column":48}]}]}"

When I finally turned to the Explorer, I discovered that not only was the value I was using correct (field: CREATED_AT), thanks to its auto

query{
__type(name:"Repository") {
fields {
name
description
type {
kind
name
description
}
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9
Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0)
@popravich
popravich / PostgreSQL_index_naming.rst
Last active March 25, 2024 12:42
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;