Skip to content

Instantly share code, notes, and snippets.

View RootPat's full-sized avatar

Patrick Harris RootPat

View GitHub Profile
$(function () {
$(".newsticker01").jCarouselLite({
vertical: true,
hoverPause: true,
visible: 1,
auto: 6000,
speed: 2000
});
$.featureList($("#tabs li a"), $("#output li"), { start_item: 0 });
from chatterbot import ChatBot
# Uncomment the following lines to enable verbose logging
# import logging
# logging.basicConfig(level=logging.INFO)
# Create a new instance of a ChatBot
bot = ChatBot(
"SQLMemoryTerminal",
storage_adapter='chatterbot.storage.SQLStorageAdapter',
from chatterbot import ChatBot
# Uncomment the following lines to enable verbose logging
# import logging
# logging.basicConfig(level=logging.INFO)
# Create a new ChatBot instance
bot = ChatBot(
'Terminal',
#os module for system functions
#AES and SHA256 modules for encryption
#we use SHA-256 to produce a 16 byte output which works great with AES-256
import os
from random import randint
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
# enumerating the file system, pass in file path to directory you wish to encrypt
@RootPat
RootPat / add_firebase_to_webapp.js
Created December 19, 2017 04:32
JS script to add before </body> tag of HTML page
<script src="https://www.gstatic.com/firebasejs/4.8.1/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "GOOGLE_API_KEY",
authDomain: ".firebaseapp.com",
databaseURL: ".firebaseio.com",
projectId: "",
storageBucket: "",
@RootPat
RootPat / api_call_function.js
Last active December 19, 2017 00:34
JS function REST api call from button click
// javascript:
function ApiCall() {
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "REST URL HERE", true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.send();
var response = JSON.parse(xhttp.responseText);
}
// Corresponding HTML button action:
@RootPat
RootPat / result_display.js
Created December 19, 2017 00:28
Display result of Javascript function in a div element using inline HTML
<script type="text/javascript">
function calc()
{
var total = 0;
var course = 0;
var nrOfLessons = 0;
var vat = 0;
course = Number(document.getElementById("course").value)
nrOfLessons = Number(document.getElementById("nrOfLessons").value)
<h2><?php _e( 'Recent news from Some-Other Blog:', 'my-text-domain' ); ?></h2>
<?php // Get RSS Feed(s)
include_once( ABSPATH . WPINC . '/feed.php' );
// Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed( 'http://pat.world/feed/' );
if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly
import socket
import threading
bind_ip = '127.0.0.1'
bind_port='80'
server=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('127.0.0.1',80))
server.listen(5)
print("[*] Listening on %s:%d" % ('127.0.0.1', 80))
import socket
target_host=''
target_port=''
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client.sendto("Recon my dudes",(target_host, target_port))
data, addr = client.recvfrom(4096)
print(data)