Skip to content

Instantly share code, notes, and snippets.

View benthecoder's full-sized avatar
🚀
shipping

Benedict Neo 梁耀恩 benthecoder

🚀
shipping
View GitHub Profile
date label
a8c6911b N
eebdce12 N
6fb420a6 L
3bf8b132 N
date avg.temp max.temp min.temp precipitation avg.wind.speed max.wind.speed max.wind.speed.dir max.inst.wind.speed max.inst.wind.speed.dir min.atmos.pressure
229b70a3 3.3 10.2 -2.4 0 2.9 9.3 W 14.3 W 1015.1
3134f4ff 5.7 13.7 -2.9 0 3.6 10.7 W 15.8 W 1011.3
dbfaf910 13.8 20 9 0 5.3 9.4 SW 15.2 W 1004.2
3aea0cf0 11.4 19.3 5.8 0 4.2 10.1 SW 20.6 SW 1001.7
f0227f56 2.4 7.7 0.3 43.5 0.9 3.7 SW 5.7 SW 1003.5
@benthecoder
benthecoder / nlp-text-processing.py
Last active December 25, 2021 14:07
NLP text processing methods
# NLP text processing functions in Python
# -----------------------
# remove punctuation
import string
# print(string.punctuation) -> '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
def remove_punc(s):
'''
class Net(nn.Module):
''' Models a simple Convolutional Neural Network'''
def __init__(self):
''' initialize the network '''
super(Net, self).__init__()
# 3 input image channel, 6 output channels,
# 5x5 square convolution kernel
self.conv1 = nn.Conv2d(3, 6, 5)
# Max pooling over a (2, 2) window
function sumAll(arr) {
var result = 0;
for (let i=Math.min(...arr); i<=Math.max(...arr); i++){
result+=i;
}
return result;
}
sumAll([1, 4]);
function sumAll(arr) {
return (arr[0]+arr[1])*(Math.abs(arr[0]-arr[1])+1)/2;
}
function sumAll(arr) {
var max = Math.max(...arr);
var min = Math.min(...arr);
var temp = 0;
for(var i=min; i<=max; i++){
temp += i;
}
return (temp);
}
function sumAll(arr) {
const max = Math.max(...arr);
const min = Math.min(...arr);
return((min+max)*(max - min +1)/2);
}
console.log(sumAll([1,4]));