Skip to content

Instantly share code, notes, and snippets.

View pizzapanther's full-sized avatar
🍕
Crushing it daily

Paul Bailey pizzapanther

🍕
Crushing it daily
View GitHub Profile
@pizzapanther
pizzapanther / express-template.js
Created May 19, 2018 17:52
Starter for Express
// npm install express nunjucks body-parser
const express = require('express');
const nunjucks = require('nunjucks');
const body_parser = require('body-parser');
var app = express();
nunjucks.configure('views', {
autoescape: true,
@pizzapanther
pizzapanther / explain.jsx
Created November 16, 2017 20:37
Explain This Code
class MyComponent extends React.Component {
constructor(props) {
// set the default internal state
this.state = {
clicks: 0
};
}
componentDidMount() {
this.refs.myComponentDiv.addEventListener('click', this.clickHandler);
@pizzapanther
pizzapanther / run_tornado.py
Last active April 20, 2021 15:46
Tornado + Django WebSocket Combination
#!/usr/bin/env python
import tornado.httpserver
import tornado.ioloop
import tornado.log
import tornado.web
import tornado.wsgi
import tornado.websocket
class MyWebSocket(tornado.websocket.WebSocketHandler):
@pizzapanther
pizzapanther / wifi_hack.py
Created August 11, 2017 12:33
Houston Airport Wifi hack to get past their bad certificate
import requests
payload = {
'cmd': 'authenticate',
'user': 'hou-user',
'password': '45453395'
}
r = requests.post('https://securelogin.arubanetworks.com/cgi-bin/login', payload, verify=False)
@pizzapanther
pizzapanther / tpl_finder.py
Created July 19, 2017 15:50
finds all my templates and bundles them up
def tpl_files ():
tpls = []
base_dir = os.path.join(settings.BASE_DIR, 'static', 'nac')
for root, dirs, files in os.walk(base_dir):
for file in files:
if file.endswith('.html'):
fullpath = os.path.join(root, file)
relpath = fullpath.replace(base_dir + '/', '').replace('/', '-')
relpath = relpath[:-5]
with open(fullpath, 'r') as fh:
@pizzapanther
pizzapanther / gulpfile.js
Created July 13, 2017 02:19
Gulp Example
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var concat = require("gulp-concat");
var less = require('gulp-less');
var rollup = require('rollup').rollup;
var buble = require('rollup-plugin-buble');
var resolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var build_tasks = ['build-js', 'build-css'];
@pizzapanther
pizzapanther / circle.yml
Created July 11, 2017 01:53
CircleCI with Selenium Testing
machine:
node:
version: 6.11.0
dependencies:
pre:
# Install Selenium.
- curl -O http://selenium-release.storage.googleapis.com/3.0/selenium-server-standalone-3.0.1.jar
- curl https://chromedriver.storage.googleapis.com/2.30/chromedriver_linux64.zip | gzip -dc > chromedriver
- chmod +x chromedriver
@pizzapanther
pizzapanther / browser-test.js
Created July 11, 2017 00:43
browser test with webdriver.io
var chai = require('chai');
var expect = chai.expect;
var webdriverio = require('webdriverio');
describe('my webdriverio tests', function() {
this.timeout(60000);
var client;
before(function(){
client = webdriverio.remote({ desiredCapabilities: {browserName: 'chrome'} });
from fabric.api import run, env, sudo, cd, prefix, shell_env
env.hosts = ['45.32.207.111']
env.user = 'paul'
DIR = '/home/paul/AppFish'
VENV = 'source SECRETS.ENV'
def start ():
with cd(DIR):
import React, { Component } from 'react';
class HelloLi extends Component {
handleClick(event, item) {
if (item.selected) {
item.selected = false;
} else {
item.selected = true;
}