Skip to content

Instantly share code, notes, and snippets.

View panamantis's full-sized avatar

Jon panamantis

View GitHub Profile
// Created by Anderson Mancini 2023
// React Three Fiber AutoFocus Component to be used
// as an extension for default Depth Of Field from react-three/postprocessing
// HOW TO USE?
// import AutoFocusDOF from './AutoFocusDOF'
//
// And add this component inside the EffectsComposer...
//...
// <EffectComposer>
import requests
headers = {"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36",
}
company_link = 'https://www.linkedin.com/voyager/api/entities/companies/2652230'
with requests.session() as s:
s.cookies['li_at'] = "your li_at cookie"
s.cookies["JSESSIONID"] = "your JSESSIONID"
@zapalote
zapalote / extract-gbooks-terms.py
Last active April 2, 2024 11:31
Example of multi-threading and memory mapped file processing.
# extraction pattern: ngram TAB year TAB match_count TAB volume_count NEWLINE
# out: unique_ngram TAB sum(match_count) NEWLINE
import re
import os, sys, mmap
from pathlib import Path
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor
abv = re.compile(r'^(([A-Z]\.){1,})(_|[^\w])') # A.B.C.
import requests
from bs4 import BeautifulSoup
import pandas as pd
import time
baseurl = 'http://publicreporting.ltchomes.net/en-ca/'
url = baseurl + 'Search_Selection.aspx'
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
@vznncv
vznncv / paramiko_sftp_large_file_downloading_demo.py
Created January 18, 2020 09:26
Workaround to download a large file with paramiko from a sftp server
"""
The script contains example of the paramiko usage for large file downloading.
It implements :func:`download` with limited number of concurrent requests to server, whereas
paramiko implementation of the :meth:`paramiko.SFTPClient.getfo` send read requests without
limitations, that can cause problems if large file is being downloaded.
"""
import logging
import os
@flavioespinoza
flavioespinoza / depth_chart.html
Last active April 21, 2023 14:00
D3 Market Depth Chart built from Order Book
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>d3 depth chart</title>
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
<style>
@nbremer
nbremer / .block
Last active June 9, 2020 05:08
Gooey effect - Data visualization showcase
height: 680
@brianpeiris
brianpeiris / disktone.py
Last active December 8, 2016 12:35
A python program (for windows) that plays tones based on disk activity
import time
import psutil
import winsound
last_disk_time = None
last_time = None
while (True):
curr_time = time.time()
counters = psutil.disk_io_counters()
@seansummers
seansummers / cph.py
Last active April 17, 2020 17:08
Jython classPathHacker to load JDBC
def loadJar(jarFile):
'''load a jar at runtime using the system Classloader (needed for JDBC)
adapted from http://forum.java.sun.com/thread.jspa?threadID=300557
Author: Steve (SG) Langer Jan 2007 translated the above Java to Jython
Reference: https://wiki.python.org/jython/JythonMonthly/Articles/January2007/3
Author: seansummers@gmail.com simplified and updated for jython-2.5.3b3+
>>> loadJar('jtds-1.3.1.jar')
>>> from java import lang, sql