Skip to content

Instantly share code, notes, and snippets.

View patmigliaccio's full-sized avatar
🎧
jammin

Pat Migliaccio patmigliaccio

🎧
jammin
View GitHub Profile
@patmigliaccio
patmigliaccio / rdp.sh
Created December 30, 2017 17:04
bash script to rdp into windows server with rdesktop
#!/bin/sh
# Reference: https://stackoverflow.com/a/38860/5199198
SERVER=SERVER_NAME
USER=USER_NAME
DOMAIN=DOMAIN_NAME
/usr/bin/rdesktop -g 1152x864 \
-a 16 \
@patmigliaccio
patmigliaccio / prettier-git-config.sh
Last active September 22, 2020 20:41
updates entire git repo history with prettier based on .prettierrc
#!/bin/sh
# Reference: https://medium.com/millennial-falcon-technology/reformatting-your-code-base-using-prettier-or-eslint-without-destroying-git-history-35052f3d853e
git filter-branch --tree-filter 'prettier --config ../../.prettierrc --write "src/{app,environments,assets}/**/*{.ts,.js,.json,.css,.scss}" || echo "formatting error"' -- --all
@patmigliaccio
patmigliaccio / rdp-azure.sh
Last active September 27, 2022 11:58
bash script to rdp into azure vm / windows server with freerdp
#!/bin/sh
# RDP into Azure VM / Windows machine using `xfreerdp`
#
# Reference: https://github.com/FreeRDP/FreeRDP/issues/2128#issuecomment-213505787
#
# Required dependency: http://www.freerdp.com/
#
# Preferred over `rdesktop` due to: https://github.com/rdesktop/rdesktop/issues/71
@patmigliaccio
patmigliaccio / concurrent_http.go
Last active March 5, 2018 03:03
A quick Go script, testing the performance of using concurrent channels for HTTP requests.
/**
* A quick Go script, testing the performance of using
* concurrent channels for HTTP requests.
*
* Example:
* $ go run concurrent_http.go https://google.com https://facebook.com
*
* -- Consecutive --
* GET: https://google.com
* 0.61 elapsed with response length: 10711 https://google.com
@patmigliaccio
patmigliaccio / keybase.md
Last active May 12, 2018 23:04
confirmation proof for keybase.io

Keybase proof

I hereby claim:

  • I am patmigliaccio on github.
  • I am patmigliaccio (https://keybase.io/patmigliaccio) on keybase.
  • I have a public key ASCBxsyiCy5TXXNF83e18qN1B-1Ya9YD6ow6XsOVnGxcIgo

To claim this, I am signing this object:

@patmigliaccio
patmigliaccio / purge-css-cloudflare.sh
Last active September 13, 2023 01:47
Executes cURL to purge the cache on Cloudflare for a specified set or all files (requires config)
#!/bin/sh
# Author: Pat Migliaccio <pat@patmigliaccio.com>
# License: MIT
EMAIL="<Acct_Email>"
ZONE="<Zone_ID>"
API_KEY="<API_Key>"
DATA="{ \"files\": [\"https://example.com/css/style.css\"] }"
@patmigliaccio
patmigliaccio / uber_history.go
Last active November 30, 2018 19:54
A Go script that pulls Uber ride history and fare details
/**
* A Go script that pulls Uber ride history and fare details
*
* Example:
* $ go run concurrent_http.go
*
* New York | Base: $1.16 -- Duration Cost: $2.32 -- Distance Cost (mile): $4.53 -- Service Fees: $2.35 -- Duration: 13.67min
* New Jersey | Base: $1.16 -- Duration Cost: $0.66 -- Distance Cost (mile): $1.83 -- Service Fees: $2.35 -- Duration: 3.88min
* New Jersey | Base: $1.10 -- Duration Cost: $0.86 -- Distance Cost (mile): $1.94 -- Service Fees: $2.20 -- Duration: 5.40min
* New Jersey | Base: $1.10 -- Duration Cost: $2.38 -- Distance Cost (mile): $1.47 -- Service Fees: $2.20 -- Duration: 14.87min
@patmigliaccio
patmigliaccio / resolving-nested-promises-1.js
Created April 4, 2019 20:00
patmigliaccio.com/resolving-nested-promises 4/4/19
const activeUsers = await post.getActiveUsers();
@patmigliaccio
patmigliaccio / resolving-nested-promises-2.js
Created April 4, 2019 20:01
patmigliaccio.com/resolving-nested-promises 4/4/19
[
{
id: '8190834',
commentIds: [ '0002434', '0002437', '0002440' ]
},
{
id: '8190835',
commentIds: [ '0002436', '0002437', '0002441' ]
}
]
@patmigliaccio
patmigliaccio / resolving-nested-promises-3.js
Created April 4, 2019 20:02
patmigliaccio.com/resolving-nested-promises 4/4/19
const activeUsers = await post.getActiveUsers();
const activeUsersComments = activeUsers.map(user => {
user.comments = user.commentIds.map(async commentId => {
return await comments.getCommentById(commentId)
});
return user;
});