Skip to content

Instantly share code, notes, and snippets.

Pete Corey pcorey

Block or report user

Report or block pcorey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pcorey
pcorey / .spacemacs
Created Sep 10, 2018
My .spacemacs config file
View .spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@pcorey
pcorey / fourths.exs
Created Aug 15, 2018
Diatonic fourths in C using the Chord project. https://github.com/pcorey/chord/
View fourths.exs
# 0 1 2 3 4 5 6 7 8 9 10 11
# C D E F G A B
f_maj7 = [5, 9, 0, 4]
b_m7b5 = [11, 2, 5, 9]
e_m7 = [4, 7, 11, 2]
a_m7 = [9, 0, 4, 7]
d_m7 = [2, 5, 9, 0]
g_7 = [7, 11, 2, 5]
c_maj7 = [0, 4, 7, 11]
View recursive_discriminators.js
const Schema = require("mongoose").Schema;
const mongoose = require("mongoose");
const checkSchema = new Schema(
{},
{
discriminatorKey: "type",
_id: false
}
);
@pcorey
pcorey / rule30.exs
Last active Dec 5, 2017
Rule 30 using Elixir streams
View rule30.exs
# https://en.wikipedia.org/wiki/Rule_30
defmodule Rule30 do
def stream(values) do
Stream.resource(fn -> {values, 0} end, &next_fun/1, fn _ -> :ok end)
end
defp next_fun({values, layer}) do
next = ([0, 0] ++ values ++ [0, 0])
|> Enum.chunk_every(3, 1, :discard)
View abTest.js
var groups = [
{
query: {group: "A", createdAt: {$gte: ISODate("2016-01-01 05:00:00.000Z")}}
},
{
query: {group: "B", createdAt: {$gte: ISODate("2016-01-01 05:00:00.000Z")}}
}
];
groups.map(function(group, index) {
View README.md

Is there any version of input that can be used to run arbitrary code in the vm context?

The unicode line and paragraph separators (\u2028 and \u2029) can be used to break the VM interpreter, but as far as I know, it's not possible to exploit this to run arbitrary code:

evalmachine.<anonymous>:1
var test = "foo
           ^^^^

SyntaxError: Unexpected token ILLEGAL
View categories.js
orion.addEntity('categories', {
category: {
type: String,
label: 'Category',
optional: false
},
attributes: {
type: [String],
label: 'Attributes',
optional: true
@pcorey
pcorey / categories.js
Last active Aug 29, 2015
Editable Categories in Meteor's Orion
View categories.js
orion.dictionary.addDefinition('categories', 'basic', {
type: [String],
label: 'Categories'
});
orion.addEntity('articles', {
title: {
type: String,
label: 'Title'
},
You can’t perform that action at this time.