Skip to content

Instantly share code, notes, and snippets.

View jmassardo's full-sized avatar

Jenna Massardo jmassardo

  • GitHub Staff
  • Monett, MO
View GitHub Profile
@jmassardo
jmassardo / Invoke-WebRequest_Ignore_SSL.ps1
Created February 26, 2019 15:19
PowerShell hack to ignore ssl certificates when using Invoke-WebRequest
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
@jmassardo
jmassardo / create_github_org.sh
Created January 12, 2023 21:27
Auto create GitHub (GHEC) organizations via the GraphQL API endpoint
curl -H "Authorization: token ${GH_PAT}" -X POST \
-d '{"query": "mutation {create_org: createEnterpriseOrganization(input: {adminLogins: [\"<ADMIN_HANDLE>\", \"<ADMIN_HANDLE>\", \"<ADMIN_HANDLE>\"] billingEmail: \"<ADMIN_EMAIL>\" enterpriseId: \"<ENTPRISE_ID>\" login: \"<ORG_SLUG>\" profileName: \"<ORG_FULL_NAME>\" }){organization {id}}}"}' https://api.github.com/graphql
@jmassardo
jmassardo / RemoveStaleChefNodes.sh
Created August 21, 2018 13:53
Simple script to remove old nodes from a Chef Server
for node in $(knife search node "ohai_time:[* TO $(date +%s -d '30 days ago')]" -i); do
knife client delete $node
knife node delete $node
done
@jmassardo
jmassardo / fetch_user_count_by_org.rb
Created November 16, 2021 15:00
A simple ruby script to get a list of orgs and the user count for each.
#!/usr/bin/env ruby
require 'octokit'
require 'json'
client = Octokit::Client.new(access_token: ENV['GITHUB_TOKEN'])
query = <<-GRAPHQL
query {
enterprise(slug: "<MY-ENT-NAME>"){
package policy["com.styra.kubernetes.validating"].test.test
import data.policy["com.styra.kubernetes.validating"].rules.rules
test_block_priv_mode {
in := {
"kind": "AdmissionReview",
"request": {
"kind": {
"kind": "Pod",
block_priv_mode[decision] {
not excludedNamespaces[input.request.namespace]
data.library.v1.kubernetes.admission.workload.v1.block_privileged_mode[message]
decision := {
"allowed": false,
"message": message
}
}
enforce[decision] {
not excludedNamespaces[input.request.namespace]
data.library.v1.kubernetes.admission.workload.v1.block_privileged_mode[message]
decision := {
"allowed": false,
"message": message
}
}
test_post_allowed {
in := {"path": ["users"], "method": "POST"}
allow with input as in
}
#example_test.rego
test_post_allowed {
allow with input as {"path": ["users"], "method": "POST"}
}
#example.rego
package authz
allow {
input.path == ["users"]
input.method == "POST"
}