Skip to content

Instantly share code, notes, and snippets.

View wassname's full-sized avatar
🙃

wassname (Michael J Clark) wassname

🙃
View GitHub Profile
@wassname
wassname / linux_x380.md
Last active December 29, 2024 13:51
xubuntu on a Thinkpad Yoga x380

This are a collection of fixes and tweaks I used to get Xubuntu 18.04 LTS working on a lenovo thinkpad X380 yoga laptop.

# This is a blocklist to block samsung smart tv's sending meta data at home.
# Please help to collect domains!
# It could be that the TV does not receive any more updates or other services no longer work. Please report such an incident.
abtauthprd.samsungcloudsolution.com
acr0.samsungcloudsolution.com
ad.samsungadhub.com
ads.samsungads.com
amauthprd.samsungcloudsolution.com
api-hub.samsungyosemite.com
@wassname
wassname / pytorch_losses.ipynb
Created September 25, 2018 02:54
Comparing the shape of mse, l1 (mae), smoothl1loss etc in pytorch as they approach 0 error
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127.0.0.1 us.rdx2.lgtvsdp.com
127.0.0.1 us.info.lgsmartad.com
127.0.0.1 us.ibs.lgappstv.com
127.0.0.1 us.lgtvsdp.com
127.0.0.1 ad.lgappstv.com
127.0.0.1 smartshare.lgtvsdp.com
127.0.0.1 ibis.lgappstv.com
# added after fork
# from https://www.reddit.com/r/pihole/comments/6qmpv6/blacklists_for_lg_webos_tvs/ and others
@wassname
wassname / thecultureflairs.py
Created September 15, 2018 07:55
Scraping user flairs from TheCulture subreddit
# coding: utf-8
import praw
import json
from tqdm import tqdm
# I store my secret here and .gitignore it rather than risk commiting passwords
secrets = json.load(open('.secrets/reddit.json'))
userAgent = 'python:thecultureflairs.py:v1.0 (by {})'.format(secrets['username'])
reddit = praw.Reddit(user_agent=userAgent, **secrets)
@wassname
wassname / sampling_multiple_ordered_seqs.ipynb
Created September 2, 2018 00:54
example of sampling_multiple_ordered_seqs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wassname
wassname / nonalexnet_model.ipynb
Last active September 19, 2018 02:07
comparing inference time vs parameters & memory usage for pytorch pretrained models
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wassname
wassname / InterpolatingScheduler.py
Last active March 2, 2019 08:30
A learning rate scheduler for pytorch which interpolates on log or linear scales
from torch.optim.lr_scheduler import _LRScheduler
import numpy as np
class InterpolatingScheduler(_LRScheduler):
def __init__(self, optimizer, steps, lrs, scale='log', last_epoch=-1):
"""A scheduler that interpolates given values
Args:
- optimizer: pytorch optimizer
- steps: list or array with the x coordinates of the interpolated values
@wassname
wassname / CausalConv2d.py
Last active July 4, 2025 13:35
pytorch Causal Conv2d
from torch.nn.modules.utils import _pair
class CausalConv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=None, dilation=1, groups=1, bias=True):
kernel_size = _pair(kernel_size)
stride = _pair(stride)
dilation = _pair(dilation)
if padding is None:
padding = [int((kernel_size[i] -1) * dilation[i]) for i in range(len(kernel_size))]
@wassname
wassname / cuda_version.py
Last active May 24, 2023 07:00
get cuda cudnn and nvidia-driver versions
import datetime
print(datetime.datetime.utcnow().strftime('%Y%m%d_%H-%M-%S'))
import torch
print(torch._C._cudnn_version(), 'cudnn')
print(torch._C._cuda_getDriverVersion(), 'cuda driver')
print(torch._C._cuda_getCompiledVersion(), 'cuda compiled version')
print(torch._C._nccl_version(), 'nccl')
for i in range(torch.cuda.device_count()):
print('device %s:'%i, torch.cuda.get_device_properties(i))