Skip to content

Instantly share code, notes, and snippets.

Avatar

CeShine Lee ceshine

View GitHub Profile
@jph00
jph00 / copilot_torch.py
Created Jul 18, 2021
This is the code that copilot nearly entirely auto-generates for a function called `finetune` and a 1-line docstring
View copilot_torch.py
# I added all the imports by hand
import torch
from torchvision.datasets import ImageFolder
from torchvision import transforms,models
from torch import nn,optim
# For all functions including this one, I wrote the name and docstring, and sometimes also the param names
def finetune(folder, model):
"""fine tune pytorch model using images from folder and report results on validation set"""
if not os.path.exists(folder): raise ValueError(f"{folder} does not exist")
@ceshine
ceshine / demo.py
Created Feb 19, 2021
Demo of the @patch_to decorator from fastcore
View demo.py
from fastcore.basics import patch_to
class Demo:
val = 10
def __init__(self, val):
self.val = val
# ====================
# The default mode
View setup_conda.sh
#!/usr/bin/env bash
set -e
cd
case "$OSTYPE" in
darwin*) DOWNLOAD=https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh; RC_FILE=.bash_profile ;;
linux*) DOWNLOAD=https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh; RC_FILE=.bashrc ;;
*) echo "unknown: $OSTYPE" ;;
esac
View tweet_deleting_script.py
# -*- coding: utf-8 -*-
""" Deletes all tweets below a certain retweet threshold.
"""
import tweepy
from datetime import datetime
# Constants
CONSUMER_KEY = ''
@tntwist
tntwist / docker-compose.yml
Last active Aug 7, 2021
pi-hole and cloudflared(dns over https) with ipv6
View docker-compose.yml
# Requirements
#1. Enable IPv6 for the docker daemon:
#$ cat /etc/docker/daemon.json
#{
# "ipv6": true,
# "fixed-cidr-v6": "2001:db8:1::/64"
#}
#2. reload docker :
#$ sudo systemctl reload docker
#3. start:
@AFRUITPIE
AFRUITPIE / fish-build-install.sh
Last active Oct 10, 2021
Install Fish Shell 3+ on Raspberry Pi
View fish-build-install.sh
#!/bin/bash
# This is a quick installer
# script I made to build and install the latest version of
# fish on my Raspberry Pi.
#
# Use at your own risk as I have made no effort to make
# this install safe!
set -e
@premek
premek / mv.sh
Last active Dec 24, 2021
Rename files in linux / bash using mv command without typing the full name two times
View mv.sh
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
View norms.md
@ceshine
ceshine / run_tf_glue.ipynb
Last active Feb 23, 2020
Train huggingface/transformers BERT model on Colab CPU with TF 2.1
View run_tf_glue.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@IanColdwater
IanColdwater / twittermute.txt
Last active Jan 14, 2022
Here are some terms to mute on Twitter to clean your timeline up a bit.
View twittermute.txt
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet