Skip to content

Instantly share code, notes, and snippets.

View Zylvian's full-sized avatar

Jarle Hjellvik Wallevik Zylvian

View GitHub Profile
@Zylvian
Zylvian / DocReplacer.cs
Created November 7, 2020 07:42
Word replacer for Word Document (C#)
using System;
using System.Text.RegularExpressions;
namespace ConsoleApp1
{
class Doc_Replacer
{
static void Main(string[] args)
{
import itertools
import string
import requests
import logging as log
from constants import Constants
"""
S = requests.Session()
PARAMS = {
class Fetcher:
def __init__(self):
self._startlink = 'https://onepiece.fandom.com/api.php?format=json&action='
self._imagestartlink = self._startlink+'imageserving&wisTitle='
self._querystartlink = self._startlink+'query&'
self.constants = Constants()
def cleanName(self, name):
"""ignore all special characters, numbers, whitespace, case"""
startlink = 'https://onepiece.fandom.com/api.php?format=json&action=query&'
test_name = "Monkey D. Luffy"
fetch_json = requests.get(startlink + 'generator=allpages&gapfrom=' + test_name + '&prop=info&inprop=url').json()
print(fetch_json)
# Gets all pages
all_pages = fetch_json['query']['pages']
# Gets first page
first_page = next(iter(all_pages.values()))
# Gets first url
#pip install requests
import requests
#import shutil
import xml.etree.ElementTree as ET
from time import localtime, strftime
#pip install python-dateutil
import dateutil.parser
import datetime
#import matplotlib.pyplot as plt
import json
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$(document).ready(function() {
$.ajaxSetup({ cache: false });
setInterval(async () => {
$.ajax({
url: 'callPy.php',
<?php
$outie = exec('sudo /usr/bin/python /var/www/html/rainFetch.py');
echo $outie;
$command = escapeshellcmd('/var/www/html/rainFetch.py');
$output = shell_exec($command);
echo $output;
?>