Skip to content

Instantly share code, notes, and snippets.

View Squishy123's full-sized avatar
๐Ÿ™Š
Ready To Rumble!

Christian Wang Squishy123

๐Ÿ™Š
Ready To Rumble!
View GitHub Profile
@Squishy123
Squishy123 / spacy_w2v_demo.py
Created September 29, 2020 17:48
word2vec demo using spacy's pre-trained model
import spacy
nlp = spacy.load("en_core_web_md", disable=['parser', 'ner'])
# Get w2v representation of the word 'breakfast'
print (nlp('breakfast').vector.size)
nlp('breakfast').vector[:10]
# Find cosine similarity between w2v representations of breakfast and universe
nlp('breakfast').similarity(nlp('universe')) # 0.044292555
doc1 = nlp("I like oranges that are sweet.")
doc2 = nlp("I like apples that are sour.")
doc1.similarity(doc2) # 0.962154245
{"lastUpload":"2020-07-14T18:26:56.890Z","extensionVersion":"v3.4.3"}
@Squishy123
Squishy123 / groupElements
Created October 5, 2019 15:17
Solution to grouping elements function
def groupElems(arr):
def aux(arr, acc=[]):
if(len(arr) <=0):
return acc
n=arr[0]
a=0
temp=[]
for i in arr:
if i == n:
@Squishy123
Squishy123 / index.html
Created April 20, 2019 03:30
basicbrowserscopejsexample
<!DOCTYPE html>
<html>
<body>
<script src="script1.js"></script>
<script src="script2.js"></script>
</body>
</html>
const scraper = require('./scraper.js');
const puppeteer = require('puppeteer');
const fs = require('fs');
require('dotenv').config();
(async () => {
try {
//launch browser
let browser = await puppeteer.launch({ headless: true });
/**
* Scraper module
* Contains the methods/functions for generic facebook search
*/
//base url for login
const LOGIN_URL = 'https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=111';
//login selectors
const LOGIN_USERNAME_SELECTOR = '#email';
@Squishy123
Squishy123 / compile.bat
Last active November 16, 2023 04:39
Getting Started with ARC Simulator
rem Use this script to compile a passed file to binary from assembly
rem Pass a filepath as a command arg
java -classpath %~dp0\ARCToolsv2.1.2.jar ARCTools.ARCAsm %1
@Squishy123
Squishy123 / genericdiagonalline.py
Created October 28, 2018 20:33
draw a generic diagonal line from lower left corner to top right corner
addLine(picture, 0, getHeight(picture)-1, getWidth(picture)-1, 0, color)
@Squishy123
Squishy123 / fastrenderer.py
Created October 23, 2018 14:36
FastRenderer Function
from threading import Thread
import math
#Divides a list into number of chunks
def chunkList(list, numChunks):
sizeChunks=int(math.floor(len(list)/numChunks))
chunks=[]
for i in range(0, numChunks):
if(i == numChunks-1):
chunks.append(list[i*sizeChunks:len(list)])
@Squishy123
Squishy123 / midterm-q3.py
Created October 12, 2018 03:12
My Solutions for CPS109 Midterms Practice
def q1():
file='C:\\Users\\Christian\\Documents\\Projects\\CPS109\\resources\\mediasources\\beach.jpg'
picture=makePicture(file)
return getRed(getPixelAt(picture, 100, 100))
print q1()
def q2():
return ord('e')