Skip to content

Instantly share code, notes, and snippets.

View Ryanb58's full-sized avatar

Taylor Brazelton Ryanb58

View GitHub Profile
@Ryanb58
Ryanb58 / serve_file_via_webdav.sh
Last active October 11, 2016 13:58
Serve up folder via webdav or a webbrowser from local machine.
# Setup folder to be browseable via webdav or a webbrowser.
pip install cherrypy
pip install wsgidav
wsgidav --host=0.0.0.0 --port=8000 --root=/home/ryanb58/Documents

Keybase proof

I hereby claim:

  • I am ryanb58 on github.
  • I am ryanb58 (https://keybase.io/ryanb58) on keybase.
  • I have a public key ASBWzKdm8QwSV0rBOy-yc6Ml3apXU36BUHJgp3019cjnAwo

To claim this, I am signing this object:

@Ryanb58
Ryanb58 / ftps_list_dir.py
Last active February 16, 2023 11:03
Quick script to connect to a FTPS server via python.
# WOrks in python 2.7 not sure if it works in python 3.
# Just straight up connect by any means possible.
from ftplib import FTP_TLS
def connect():
ftp = FTP_TLS()
ftp.debugging = 2
ftp.connect('localhost', 2121)
ftp.login('developer', 'password')
@Ryanb58
Ryanb58 / get_function_names_from_file.py
Created July 8, 2016 00:07
Grab only the names of functions defined in a python file.
import othermodule, types
function_names = [othermodule.__dict__.get(a).__name__ for a in dir(othermodule) if isinstance(othermodule.__dict__.get(a), types.FunctionType)]
for item in items:
print "from ... import " + item
@Ryanb58
Ryanb58 / delayedinterrupt.py
Created April 20, 2016 22:58 — forked from tcwalther/delayedinterrupt.py
DelayedInterrupt class - delaying the handling of process signals in Python
import signal
import logging
# class based on: http://stackoverflow.com/a/21919644/487556
class DelayedInterrupt(object):
def __init__(self, signals):
if not isinstance(signals, list) and not isinstance(signals, tuple):
signals = [signals]
self.sigs = signals
@Ryanb58
Ryanb58 / polymorphism_example.py
Last active April 8, 2016 18:45
Starter example of polymorphism using python.
# Base Vehicle:
class Vehicle:
# Constructor
def __init__(self, owner):
self.owner = owner
def get_owner(self):
return self.owner
# Methods in which every subclass will be required to implement.
@Ryanb58
Ryanb58 / what_architecture.bat
Created March 29, 2016 13:32
Figure out the architecture of your processor via the command prompt on windows.
if /i "%processor_architecture%"=="x86" (
IF NOT DEFINED PROCESSOR_ARCHITEW6432 (
echo Run 32 bit command
) ELSE (
echo Run 64 bit command 1
)
) else (
echo Run 64 bit command 2
)
@Ryanb58
Ryanb58 / dict_to_params.js
Created January 5, 2016 16:36
JavaScript dictionary to query string or params script.
params_dict = {
'name':'New Rule',
'type': 'user',
};
// URL Builder from DICT.
params = "";
index = 0;
for (var key in params_dict) {
if (index == 0) {
@Ryanb58
Ryanb58 / perfect_squares_with_vectors.cpp
Created November 30, 2015 02:32
C++ Perfect Square using a vector to hold the results.
#include <iostream>
#include <istream>
#include <vector>
#include <string>
using namespace std;
int main() {
string input;
@Ryanb58
Ryanb58 / PowerShellCommandsAndScripts
Created May 14, 2015 13:30
Useful PowerShell commands and scripts.
#To view the connected file system drives:
gdr -PSProvider 'FileSystem'