Skip to content

Instantly share code, notes, and snippets.

View maciejkos's full-sized avatar
🐼

Maciej Kos maciejkos

🐼
View GitHub Profile
@maciejkos
maciejkos / .js
Last active October 8, 2023 22:20
Copy code from Gradescope to clipboard (bookmarklet for Chrome)
// Running this bookmarklet on a Gradescope grading page adds a copy icon next to the contents of each attached file.
// Clicking the icon copies the file contents to the clipboard.
// Use case: I grade many coding assignments submitted by students to Gradescope. This bookmarklet saves me a few seconds per submission.
javascript:(function(){function copyToClipboard(text){const textarea=document.createElement('textarea');textarea.value=text;document.body.appendChild(textarea);textarea.select();document.execCommand('copy');document.body.removeChild(textarea);}const fileViewers=document.querySelectorAll('.fileViewer');fileViewers.forEach((fileViewer)=>{const copyIcon=document.createElement('i');copyIcon.className='fa fa-copy';copyIcon.style.cursor='pointer';copyIcon.style.marginLeft='10px';const fileViewerHeader=fileViewer.querySelector('.fileViewerHeader');fileViewerHeader.appendChild(copyIcon);const fileContents=fileViewer.querySelector('.hljs').textContent;copyIcon.addEventListener('click',()=>{copyToClipb
@maciejkos
maciejkos / console.cloud.google.com-1595961098559.log
Last active July 28, 2020 18:33
BigQuery UI errors in Google Chrome 84.0.4147.105 (Official Build) (64-bit) in Incognito Mode (no extensions)
conversion.js:61 Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
(anonymous) @ conversion.js:61
cloudusersettings-pa.clients6.google.com/v1alpha1/settings/CONSOLE_NAV_HIDE_PRODUCTS?key=AIzaSyCI-zsRP85UVOi0DjtiCwWBwQ1djDy741g:1 Failed to load resource: the server responded with a status of 404 ()
DevTools failed to load SourceMap: Could not parse content for https://console.cloud.google.com/shell.css.map: Unexpected token < in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for https://console.cloud.google.com/content_viewport.css.map: Unexpected token < in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for https://console.cloud.google.com/help_panel_wrapper.css.map: Unexpected token < in JSON at position 0
DevTools failed to load SourceMap: Could not parse content for https://console.cloud.google.com/page_overlay.css.map: Unexpected toke
@maciejkos
maciejkos / in_a_but_not_in_B_TWO_METHODS.sql
Last active March 5, 2021 09:37
Get those values of column A from table 1 that are not in column A in table 2 (SQL, BigQuery)
# Get those items in produce_big that are not in produce_small.
-- Inputs:
---- items in produce_big: kale, orange, cabbage, apple
---- items in produce_small: kale
-- Output:
---- orange, cabbage, apple
## There are two ways of doing this.
## Use the first methods, if you have repeated rows in produce_small, e.g., kale, kale, and it is important to account for them.
## Use the second method, if you a) don't have repeated rows in produce_small or b) you have repeated rows in produce_small, but really only care about distinct from that table.

Keybase proof

I hereby claim:

  • I am maciejkos on github.
  • I am mkos (https://keybase.io/mkos) on keybase.
  • I have a public key ASDagxyUuw1JSkG_reZ82ZcWVxLnGyauqgLuv4jKUEHsIwo

To claim this, I am signing this object:

@maciejkos
maciejkos / extract_backbone.py
Created January 31, 2020 22:16 — forked from bagrow/extract_backbone.py
Extract the multiscale backbone of a weighted complex network
#!/usr/bin/env python
# extract_backbone.py
# Jim Bagrow
# Last Modified: 2010-11-18
import sys, os
import networkx as nx
@maciejkos
maciejkos / pyvis_for_networkx.py
Last active March 27, 2023 11:54 — forked from quadrismegistus/pyvis_for_networkx.py
Draw Networkx Graph with Pyvis
def draw_graph3(networkx_graph,notebook=True,output_filename='graph.html',show_buttons=True,only_physics_buttons=False,
height=None,width=None,bgcolor=None,font_color=None,pyvis_options=None):
"""
This function accepts a networkx graph object,
converts it to a pyvis network object preserving its node and edge attributes,
and both returns and saves a dynamic network visualization.
Valid node attributes include:
"size", "value", "title", "x", "y", "label", "color".