Skip to content

Instantly share code, notes, and snippets.

@ppkliu
ppkliu / download_GoogleDrive.py
Created December 12, 2023 10:16 — forked from henrych4/download_GoogleDrive.py
A python script for downloading file in google drive
#Reference: https://stackoverflow.com/questions/38511444/python-download-files-from-google-drive-using-url
import requests
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(URL, params = { 'id' : id }, stream = True)
@ppkliu
ppkliu / tds3034.py
Created September 6, 2021 05:51 — forked from hypoxic/tds3034.py
Code used to capture a waveform from the Tek TDS3000 series and send it to python
# Hypoxic Capture via TDS 3034B
# Requires pyvisa and NI-VISA, not tested much, but figured I'd share as it would be helpful for others
import pyvisa
import numpy as np
import time as time
class Tek:
def __init__(self, source = "CH1"):
self.timeout = 5.0
@ppkliu
ppkliu / scpi_tcp.py
Created May 22, 2021 02:34 — forked from pklaus/scpi_tcp.py
Python script to send commands to a Rigol scope (or any LXI/SCPI instrument) from first principles.
#!/usr/bin/env python
"""
Zeroconf Discovery for Rigol DS1000Z-series scopes
--------------------------------------------------
Documentation worth looking at:
* http://lxistandard.org/Documents/Specifications/LXI%20Device%20Specification%202011%20rev%201.4.pdf
* http://lxistandard.org/GuidesForUsingLXI/Introducing%20LXI%20To%20Your%20Network%20Administrator%20May%2024_2013.pdf
* http://lxistandard.org/GuidesForUsingLXI/LXI_Getting_Started_Guide_May_1_2013.pdf
@ppkliu
ppkliu / docker-compose-backup.sh
Created January 28, 2021 09:35 — forked from pirate/docker-compose-backup.sh
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@ppkliu
ppkliu / fetch_stocks_price.py
Created March 4, 2017 11:56 — forked from dolphinsue319/fetch_stocks_price.py
Fetch Taiwan OTC stocks price.
# coding=utf-8
import StringIO
import csv
import requests
from bs4 import BeautifulSoup
import time
import random
from Models import *