Skip to content

Instantly share code, notes, and snippets.

@pebreo
pebreo / nix-reference.md
Last active April 5, 2023 20:55
*nix Reference

Nginx confs

{{SITES_ROOT}}/etc/nginx.conf 
/etc/nginx/conf.d/myproj.confs

/etc/nginx/sites-enabled/default
/etc/nginx/sites-available/myconf.conf
ln -s [source] [target]
ln -s /etc/nginx/sites-available/myconf.conf /etc/nginx/sites-enabled/default
@pebreo
pebreo / alltagsdemo.jade
Created December 29, 2013 20:29
All HTML/Jade tags demo
html
head
meta(charset='utf-8')
style(type='text/css')
h1 {color: red;}
link(rel='stylesheet', type='text/css', href='styles.css')
script(src='')
script(type='text/javascript')
body
h1 Headers
@pebreo
pebreo / driver.md
Last active December 23, 2020 10:52
Arduino motor driver control
#PyBoard
# screen /dev/tty.usbmodem*

# Servo Example 
# http://docs.micropython.org/en/latest/pyboard/tutorial/servo.html
import pyb
s1 = pyb.Servo(1) # pin X1
s1.angle(45)
@pebreo
pebreo / django-jquery-demo.py
Last active April 29, 2020 05:15
jQuery AJAX + Django SIMPLE DEMO
# views.py - django app called ajx
from django.shortcuts import render, get_object_or_404, redirect, HttpResponse, render_to_response, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth import authenticate, login
import json
def mygetview(request):
if request.method == 'GET':
@pebreo
pebreo / ngram.py
Last active July 28, 2018 21:02
An n-gram generator in Python (newbie program)
from collections import Counter
from random import choice
import re
class Cup:
""" A class defining a cup that will hold the words that we will pull out """
def __init__(self):
self.next_word = Counter() # will keep track of how many times a word appears in a cup

Hive

Goal: Surround your opponent's Bee completely (either color).

Setup: Each player should have:
* 1 Bee
* 3 Ants
@pebreo
pebreo / writing-bootstrap.md
Last active May 3, 2018 15:33
Writing patterns

Writing patterns

Sentence openers/Dressing up sentences

1. Subject opener. 

The dog chased the cat.t
@pebreo
pebreo / django-referenc.md
Last active March 1, 2018 17:37
Django-reference
@pebreo
pebreo / math-patterns.md
Last active May 31, 2017 15:52
Math Patterns

Math Links

Attitude

Math is like riding a bicycle. The best way to learn is to get on the bicycle and start peddling. You may fall but ultimately each fall means you are getting better and better.

Word Problems

@pebreo
pebreo / js-snippets.md
Last active July 28, 2016 17:40
Javascript Snippets

Using reduce without lodash

a = [1,2,3];
var y = a.reduce(function(sum, n){
	return sum + n;
}, 0);

console.log(y);