Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Vikrum vikrum

🎯
Focusing
View GitHub Profile
@Treeki
Treeki / TurnipPrices.cpp
Last active Sep 17, 2020
AC:NH turnip price calculator
View TurnipPrices.cpp
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@paceaux
paceaux / queryCSSProperty
Last active Jun 30, 2019
Get all CSS selectors containing a particular CSS property
View queryCSSProperty
/** queryCSSByPropertyName
* queries the CSSOM looking for CSS rulesets containing a particular CSS property.
* @param {string} queryPropName CSS property name
* @param {string} queryPropValue value of CSS property
* @returns Map with key as CSS selector, value as CSS properties.
*/
function queryCSSByProperty(queryPropName, queryPropValue) {
const styleSheets= document.styleSheets; // get all the stylesheets
const properties = new Map(); // set up the variable that'll store our result
@DaisukeMiyamoto
DaisukeMiyamoto / assume_role.py
Created Sep 12, 2018
AWS Boto3 Assume Role example
View assume_role.py
import boto3
from boto3.session import Session
def assume_role(arn, session_name):
"""aws sts assume-role --role-arn arn:aws:iam::00000000000000:role/example-role --role-session-name example-role"""
client = boto3.client('sts')
account_id = client.get_caller_identity()["Account"]
print(account_id)
@nlitsme
nlitsme / breachquery.sh
Created Dec 14, 2017
query.sh for older bash versions - from magnet:?xt=urn:btih:7ffbcd8cee06aba2ce6561688cf68ce2addca0a3
View breachquery.sh
#!/bin/bash
# query.sh from BreachCompilation - magnet:?xt=urn:btih:7ffbcd8cee06aba2ce6561688cf68ce2addca0a3
# works with older bash versions.
# patch by Willem <itsme@xs4all.nl>
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ "$1" != "" ]; then
word1=$(echo $1 | tr A-Z a-z)
letter1=$(echo $word1|cut -b1)
if [[ $letter1 == [a-zA-Z0-9] ]]; then
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active Sep 23, 2020
How to add a collapsible section in markdown.
View markdown-details-collapsible.md

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@dinvlad
dinvlad / get-aws-token
Created Oct 25, 2016
Get session token for virtual MFA-enabled actions through AWS CLI
View get-aws-token
#!/bin/bash
# Thanks to MattJ at:
# http://www.brassmill.net/2015/10/using-the-aws-cli-with-roles-security-token-service-and-mfa/
#
# User must have 'iam:GetUser' permission on themselves that doesn't require MFA
[ -z $1 ] && echo "Please enter your MFA code" && exit 1
user=$(aws iam get-user \
View Principles-of-Adult-Behavior.md

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@trestletech
trestletech / instance-types.sh
Created Jun 15, 2016
Get all EC2 Instance Types in All Availability Zones
View instance-types.sh
#!/bin/bash
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
while read -r region; do
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort)
while read -r az; do
@jeremybuis
jeremybuis / angular.sandbox.escapes.md
Created Jan 27, 2016
Angular Sandbox Escape Cheatsheet
View angular.sandbox.escapes.md
View URLConnectionReader.java
// Based on java example: http://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html
// save as: URLConnectionReader.java
// compile using JDK: javac URLConnectionReader.java
// run: java URLConnectionReader
// good path: returns HTML
// bad path: throws an exception
import java.net.*;
import java.io.*;
You can’t perform that action at this time.