Skip to content

Instantly share code, notes, and snippets.

#!/anaconda/bin/python3
import os
import sys
import array
import joblib
import numbers
import numpy as np
import scipy.sparse as sp
import jwtDecode from 'jwt-decode'
import * as auth from '../actions/auth'
function getInitialState() {
let initialState = {
access: undefined,
refresh: undefined,
errors: {}
}
const authStorage = localStorage.getItem('persist:polls')
import sys
from PyPDF2 import PdfFileReader
pages = []
doc = PdfFileReader(sys.argv[1])
for num in range(doc.numPages):
page = doc.getPage(num)
pages.append(page.extractText())
print("\n".join(pages))
from django import template
from django.conf import settings
from wagtail.images.templatetags.wagtailimages_tags import image
register = template.Library()
@register.tag(name="srcset_image")
from django import template
from django.conf import settings
from wagtail.images.templatetags.wagtailimages_tags import image
register = template.Library()
@register.tag(name="srcset_image")
import pytest
from django.conf import settings
from python_podcast.users.tests.factories import UserFactory
@pytest.fixture
def user() -> settings.AUTH_USER_MODEL:
password = "password"
user = UserFactory(password=password)
@ephes
ephes / subprocess_read_write_example.py
Created March 20, 2020 12:11
Example of communication between two processes with subprocess
import subprocess
from queue import Queue
from threading import Thread
from tempfile import NamedTemporaryFile
class ClosableQueue(Queue):
SENTINEL = object()
import os
import time
import math
import psutil
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
import os
import time
import math
import psutil
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
import os
import time
import math
import psutil
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")