Skip to content

Instantly share code, notes, and snippets.

Avatar
🕳️
🌑

Dirk Avery YakDriver

🕳️
🌑
View GitHub Profile
@YakDriver
YakDriver / sync.md
Last active Jul 13, 2018
Re-sync a fork with the upstream repo
View sync.md

First, you want to make sure that your upstream is setup. Here origin is your fork and upstream is the forked repo.

$ git remote -v
origin	https://github.com/YakDriver/watchmaker.git (fetch)
origin	https://github.com/YakDriver/watchmaker.git (push)
upstream	https://github.com/plus3it/watchmaker.git (fetch)
upstream	https://github.com/plus3it/watchmaker.git (push)
@YakDriver
YakDriver / install_docker_centos.sh
Last active Jul 3, 2018
Install docker on CentOS
View install_docker_centos.sh
sudo su
yum install epel-release
yum --enablerepo=epel install docker-io
# centos 7
systemctl start docker
# centos 6
service docker start
@YakDriver
YakDriver / get_sha_hash.sh
Created May 16, 2018
SHA256 hash on posix
View get_sha_hash.sh
shasum -a 256 filename.txt
@YakDriver
YakDriver / Filesize.rst
Created May 9, 2018
Possible differences in file sizes
View Filesize.rst

$ du -h filename # shows the size in kiB/MiB/GiB (1024 increments) $ du -h --si filename # shows the size in kB/MB/GB (1000 increments)

@YakDriver
YakDriver / list_files.py
Created Apr 26, 2018
List all files in pythonpath, sys.path, search path
View list_files.py
import sys
import os
import glob
for path in sys.path:
for afile in glob.glob(os.path.join(path, '*')):
print(os.path.join(path, afile))
@YakDriver
YakDriver / query_operation.graphql
Last active Apr 20, 2018
GraphQL GitHub API examples, using operations
View query_operation.graphql
# named operation
query GetRelease($owner: String!, $repo: String!, $tag: String!) {
repository(
owner: $owner,
name: $repo
) {
release(tagName: $tag) {
name
id
releaseAssets(first:10) {
@YakDriver
YakDriver / github_release.qraphql
Last active Apr 20, 2018
GraphQL GitHub API Examples (Query Releases)
View github_release.qraphql
query {
repository(
owner: "YakDriver",
name: "pyppyn"
) {
release(tagName: "0.2.3") {
name
id
releaseAssets(first:10) {
nodes {
@YakDriver
YakDriver / create_test_file.ps1
Created Mar 23, 2018
Creates a file filled with null for testing
View create_test_file.ps1
$f = new-object System.IO.FileStream C:\Temp\test.dat, Create, ReadWrite
$f.SetLength(40MB)
$f.Close()
@YakDriver
YakDriver / am_i_admin.ps1
Created Mar 23, 2018
Is PowerShell script running as administrator? Find out from inside the script.
View am_i_admin.ps1
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
{
View terraform_debug.log
2018-03-22T15:09:41.743Z [DEBUG] plugin.terraform: file-provisioner (internal) 2018/03/22 15:09:41 Uploading file to 'C:\scripts\check_build.ps1'
2018-03-22T15:09:42.378Z [DEBUG] plugin.terraform: remote-exec-provisioner (internal) 2018/03/22 15:09:42 connecting to remote shell using WinRM
2018-03-22T15:09:42.408Z [DEBUG] plugin.terraform: remote-exec-provisioner (internal) 2018/03/22 15:09:42 Uploading file to 'C:/Temp/terraform_1217694552.cmd'
2018-03-22T15:09:43.054Z [DEBUG] plugin.terraform: remote-exec-provisioner (internal) 2018/03/22 15:09:43 starting remote command: C:/Temp/terraform_1217694552.cmd
2018-03-22T15:10:52.390Z [DEBUG] plugin.terraform: remote-exec-provisioner (internal) 2018/03/22 15:10:52 Uploading file to 'C:/Temp/terraform_1217694552.cmd'
2018/03/22 15:10:53 [DEBUG] plugin: waiting for all plugin processes to complete...
2018-03-22T15:10:53.201Z [DEBUG] plugin.terraform: remote-exec-provisioner (internal) 2018/03/22 15:10:53 [ERR] plugin: plugin server: accept unix /tmp/plugin522209802