View Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function detectBrowser(userAgent, language) { | |
var version, webkitVersion, iOSAgent, iOSDevice, iOSMajorVersion, iOSMinorVersion, browser = {}; | |
userAgent = (userAgent || navigator.userAgent).toLowerCase(); | |
language = language || navigator.language || navigator.browserLanguage; | |
version = browser.version = (userAgent.match(/.*(?:rv|chrome|webkit|opera|ie)[\/: ](.+?)([ \);]|$)/) || [])[1]; | |
webkitVersion = (userAgent.match(/webkit\/(.+?) /) || [])[1]; | |
iOSAgent = (userAgent.match(/\b(iPad|iPhone|iPod)\b.*\bOS (\d)_(\d)/i) || []); | |
iOSDevice = iOSAgent[1]; | |
iOSMajorVersion = iOSAgent[2]; | |
iOSMinorVersion = iOSAgent[3]; |
View gist:cbb786d01a85d6924cc8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Originally found on - http://earthwithsun.com/questions/313650/resume-zsh-terminal-os-x-lion | |
# Tell the terminal about the working directory whenever it changes. | |
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then | |
update_terminal_cwd() { | |
# Identify the directory using a "file:" scheme URL, including | |
# the host name to disambiguate local vs. remote paths. | |
# Percent-encode the pathname. | |
local URL_PATH='' |
View gist:509d048561db92195600
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mosh uses udp range 60000 - 61000. Just allow 60000 alone for added security | |
-A INPUT -p udp -m multiport --dports 60000:61000 -j ACCEPT |
View org-scan.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Script to clone repos from github and invoke ShiftLeft Scan | |
# You should have added your ssh public key to GitHub and have read access | |
# Create a PAT token for GitHub and store it as GITHUB_TOKEN env variable | |
CURR_DIR=$(pwd) | |
mkdir -p reports_dir | |
mkdir -p work_dir && cd work_dir | |
# Get the latest scan image | |
docker pull shiftleft/scan |
View summary.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
from pathlib import Path | |
import json | |
# pip install jinja2 | |
from jinja2 import Template |
View inspect.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script invokes Shiftleft Inspect on the current directory | |
{ # Prevent execution if this script was only partially downloaded | |
check_app_dir() { | |
if [ "$(pwd)" == "$HOME" ]; then | |
echo Please run this command from within the application directory and not from your HOME directory | |
exit 1 | |
fi | |
} | |
download() { |
View bom.xslt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" xmlns:bom="http://cyclonedx.org/schema/bom/1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="text" /> | |
<xsl:template match="/"> | |
<xsl:text>## Project dependencies</xsl:text> | |
<xsl:text>

</xsl:text> | |
<xsl:text>| Vendor | Name | Version | License Id | </xsl:text> | |
<xsl:text>
</xsl:text> | |
<xsl:text>| -------|------|---------|------------|</xsl:text> | |
<xsl:text>
</xsl:text> |
View git-scan.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Script to clone top repos on github based on language and invoke ShiftLeft Scan against the repos to find vulnerabilities | |
# Use case 1: Scan the top repos on GitHub and write a state of opensource report to criticize opensource! | |
# Use case 2: Scan the top repos on GitHub and sell your magical security product to guard organizations against opensource vulnerabilities! | |
CURR_DIR=$(pwd) | |
mkdir -p reports_dir | |
mkdir -p work_dir && cd work_dir | |
# Get the latest scan image | |
docker pull shiftleft/scan |
View git-protect.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Protect the master branch. Enforce that ci/tests and shiftleft should pass to allow merges | |
# Allow PR to be dismissed by sem-user and managers team | |
resource "github_branch_protection" "protect_master" { | |
repository = "${github_repository_name}" | |
branch = "master" | |
enforce_admins = true | |
require_signed_commits = false | |
required_status_checks { | |
strict = false |
View github-actions-secret-tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "github_repository" "poc" { | |
full_name = var.poc_repo | |
} | |
// Create secrets in a single poc repo | |
resource "github_actions_secret" "my_secret" { | |
repository = data.github_repository.poc.name | |
secret_name = "SECRET_KEY" | |
plaintext_value = var.secret_value | |
} |
OlderNewer