Skip to content

Instantly share code, notes, and snippets.

@littleairmada
littleairmada / al2_enable_selinux.txt
Created March 1, 2022 00:02
Amazon Linux 2: Enable SELinux
# The Standard Caveat applies: Always test before you implement on a production system.
# These steps assume you are connected to an AL2 EC2 instance as the ec2-user.
# I use this to enable SELinux as the very first step when creating a base AMI. It has worked for me without issues for the past 3+ years.
# 1. Install packages and autorelabel the filesystem
sudo yum -y install policycoreutils selinux-policy-targeted policycoreutils-python
sudo sed -i 's/SELINUX=disabled/SELINUX=permissive/g' /etc/selinux/config
sudo systemctl enable rhel-autorelabel
sudo systemctl enable rhel-autorelabel-mark
@duboisf
duboisf / operations.graphql
Last active July 19, 2024 06:39
Add branch protection to a repo using GitHub's Graphql API
fragment branchProtection on BranchProtectionRule {
allowsDeletions
allowsForcePushes
creator {
login
}
id
isAdminEnforced
requiredStatusCheckContexts
requiredApprovingReviewCount
@MichaelCurrin
MichaelCurrin / README.md
Last active January 16, 2023 15:37
Python example - convert text to JSON structure #python #json

Python example - convert text to JSON structure

The Python script below demonstrates how to use regex to match on text with a known structure to build a dictionary, then convert the output to JSON data.

The task comes from this StackOverflow question.

Rather than using a procedural approach to handle the lines one at a time and extract the relevant items, I split the text into chunks and then dealt with each using regex pattern to extract the relevant pieces. Expecting questions A and B to always be present and C and D to be there sometimes.

Note use brackets for capture groups.

@MichaelCurrin
MichaelCurrin / README.md
Last active January 30, 2024 18:04
GitHub GraphQL - Get owned repos

Public repos owned by the current user

Get repos from the GitHub GraphQL API which are owned by the authenticated user (owner of the token).

Customize the query

Instead of OWNER, you can also change the ownerAffiliations filter in the query to be COLLABORATOR or ORGANIZATION_MEMBER. Or omit the filter.

Instead of setting privacy filter to PUBLIC, you can set to PRIVATE. Or omit the filter.

@MichaelCurrin
MichaelCurrin / README.md
Last active March 6, 2024 10:19
Twitter GraphQL sample

Twitter GraphQL sample

Example of using a GraphQL service to explore the Twitter API

A great way to explore the Twitter API and returned data, without worrying about authorization or local setup. Just add a query in the explorer and hit run.

About

The GraphQL Hub website has an interactive GraphiQL service which allows access to Gitub, Twitter, Giphy and other APIs in the browser without authorization.

@scmx
scmx / using-details-summary-github.md
Last active November 12, 2024 20:44
Using <details> <summary> expandable content on GitHub with Markdown #details #summary #markdown #gfm #html

How to use <details> <summary> expandable content on GitHub with Markdown

Firstly, what is <details> <summary>?

The HTML Details Element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the <summary> element. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details.

Example

@tobywf
tobywf / clean_old_lambda_versions.py
Last active September 9, 2024 17:50
A quick script to remove old AWS Lambda function versions
from __future__ import absolute_import, print_function, unicode_literals
import boto3
def clean_old_lambda_versions():
client = boto3.client('lambda')
functions = client.list_functions()['Functions']
for function in functions:
versions = client.list_versions_by_function(FunctionName=function['FunctionArn'])['Versions']
for version in versions:
@aakash14goplani
aakash14goplani / Introduction.md
Last active May 27, 2024 08:57
Introduction to WCS

Oracle WebCenter Sites is a high-performance, large-scale content management and delivery system. Oracle WebCenter Sites is used to create and manage large and complex websites, sites that run businesses, and other types of sites, all of which are generically referred to as "online sites" or "websites."

When site visitors visit your website, you want them to have an interactive, personalized experience that keeps them loyal to your brand. You want them to access the most up-to-date experience that keeps them loyal to your brand. You want them to access the most up-to-date content relevant to their interests, navigate your pages seamlessly, and encourage them to participate in commenting and rating your content (articles, products, services, and so on).

Site visitors neither see what is driving this interactive, personalized experience in the back end nor the WebCenter Sites and the intricacies between Sites and its supplemental offerings that enhance the user experience (UX) with your website.

Job

@andreicristianpetcu
andreicristianpetcu / ansible-summary.md
Created May 30, 2016 19:25
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: