Skip to content

Instantly share code, notes, and snippets.

View ParzivalWins's full-sized avatar
💭
Know Thyself

Parzival ParzivalWins

💭
Know Thyself
View GitHub Profile
@kepano
kepano / obsidian-web-clipper.js
Last active July 26, 2024 00:31
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@discdiver
discdiver / jupyterlab_shortcuts.md
Last active July 13, 2024 08:55
Common Jupyter Lab Keyboard Shortcuts

If you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).

Shortcuts when in either command mode (outside the cells) or edit mode (inside a cell):

  • Shift + Enter run selected cell or cells - if no cells below, insert a code cell below

  • Ctrl + B toggle hide/show left sidebar

  • Ctrl + S save and checkpoint

  • Ctrl + Shift + S save as

@idleuncle
idleuncle / shuffle.py
Last active March 7, 2020 04:35
[Shuffle]
def shuffle(train_data: np.array, seed: int = 8864):
np.random.seed(seed)
n = train_data.shape[0]
indices = np.random.randint(0, n, n)
train_data = [train_data[i] for i in indices]
@allenday
allenday / zero-fee-bitcoin-tx.sql
Created January 25, 2019 07:39
Find zero-fee Bitcoin transactions
SELECT
ROUND((input_value - output_value)/ size, 0) AS fees_per_byte,
COUNT(*) AS txn_cnt
FROM
`bigquery-public-data.crypto_bitcoin.transactions`
WHERE TRUE
AND block_timestamp >= '2018-01-01'
AND is_coinbase IS FALSE
GROUP BY 1
import anki_vector
import time
from PIL import Image
import cv2
import numpy as np
import matplotlib.pyplot as plt
with anki_vector.Robot(enable_camera_feed=True) as robot:
robot.motors.set_head_motor(-5.0) # move head to look at ground
robot.motors.set_wheel_motors(10, 10) # set initial driving direction
@jayspeidell
jayspeidell / kaggle_download.py
Last active July 18, 2023 12:23
Sample script to download Kaggle files
# Info on how to get your api key (kaggle.json) here: https://github.com/Kaggle/kaggle-api#api-credentials
!pip install kaggle
api_token = {"username":"USERNAME","key":"API_KEY"}
import json
import zipfile
import os
with open('/content/.kaggle/kaggle.json', 'w') as file:
json.dump(api_token, file)
!chmod 600 /content/.kaggle/kaggle.json
!kaggle config path -p /content
// DarkSky API
// CORS requests are NOT allowed by the DarkSky server
// Requests from other Servers are allowed
// So, we would make a pass thru file on a server.
// Browser sends the fetch( ) AJAX request to OUR server
// OUR server sends the AJAX request to DarkSky server
// DarkSky responds to OUR Server
// OUR Server sends the DarkSky reply back to Browser
// Browser AJAX call => Our Server => DarkSky => Our Server => Browser AJAX call

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@arthurattwell
arthurattwell / pandoc-docx-md.bat
Last active September 5, 2023 02:35
Script to convert docx to markdown with Pandoc
:: pandoc-docx-md.bat
::
:: Don't show these commands to the user
@ECHO off
:: Set the title of the window
TITLE Convert docx to markdown with Pandoc
:: Select file marker
:selectfile
:: Clear any preexisting filename variables
SET filename=
@tonysneed
tonysneed / Mac OS X: Open in Visual Studio Code
Last active June 14, 2024 04:16
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"