Skip to content

Instantly share code, notes, and snippets.

@fpcMotif
fpcMotif / gpt4_abbreviations.md
Created April 5, 2023 17:34 — forked from VictorTaelin/gpt4_abbreviations.md
Notes on the GPT-4 abbreviations tweet

Notes on this tweet.

  • The screenshots were taken on different sessions.

  • The entire sessions are included on the screenshots.

  • I lost the original prompts, so I had to reconstruct them, and still managed to reproduce.

  • The "compressed" version is actually longer! Emojis and abbreviations use more tokens than common words.

@fpcMotif
fpcMotif / loadvgg.py
Created December 4, 2018 03:33 — forked from hasnainv/loadvgg.py
Convert Caffe models to Keras models
#How to load the model
def build_model(img_width=224, img_height=224):
from keras.models import Sequential
from keras.layers import Convolution2D, ZeroPadding2D, MaxPooling2D, Activation
model = Sequential()
model = Sequential()
model.add(ZeroPadding2D((1,1),input_shape=(3,img_width,img_height)))
model.add(Convolution2D(64, 3, 3, activation='relu', name='conv1_1'))
model.add(Activation('relu'))
@fpcMotif
fpcMotif / months_between_dates.R
Created October 29, 2018 15:20 — forked from lhmet/months_between_dates.R
Number of months between two dates
library(lubridate)
dates <- c("2011-01-17", "2009-11-21")
p <- as.period( interval( ymd(dates), Sys.Date() ) )
year(p)*12 + month(p)
interval(dates, today()) %/% months(1)
@fpcMotif
fpcMotif / lagrange.py
Created October 27, 2018 06:40 — forked from melpomene/lagrange.py
Lagrange interpolation in python
import numpy as np
import matplotlib.pyplot as plt
import sys
def main():
if len(sys.argv) == 1 or "-h" in sys.argv or "--help" in sys.argv:
print "python lagrange.py <x1.y1> .. <x_k.y_k>"
print "Example:"
print "python lagrange.py 0.1 2.4 4.5 3.2"
@fpcMotif
fpcMotif / lagrange.py
Created October 27, 2018 06:40 — forked from melpomene/lagrange.py
Lagrange interpolation in python
import numpy as np
import matplotlib.pyplot as plt
import sys
def main():
if len(sys.argv) == 1 or "-h" in sys.argv or "--help" in sys.argv:
print "python lagrange.py <x1.y1> .. <x_k.y_k>"
print "Example:"
print "python lagrange.py 0.1 2.4 4.5 3.2"
import random
from facebookads.adobjects.adcreativeobjectstoryspec import AdCreativeObjectStorySpec
from facebookads.adobjects.adcreativelinkdata import AdCreativeLinkData
from ads_app.api import AdsApi
from ads_app.api.objects import Ad, AdLabel, CarouselAd
from sjp_app.documents.sjp_image import SjpImage
from sjp_app.documents.strategy import Strategy
from w4.documents.mongo_job import MongoJob
@fpcMotif
fpcMotif / map-new-legend.R
Created October 21, 2018 21:52 — forked from mollietaylor/map-new-legend.R
Custom Legend in R
library(OIdata)
library(RColorBrewer)
library(classInt)
# load state data from OIdata package:
data(state)
# set constants:
nclr <- 8 # number of bins
min <- 0 # theoretical minimum
@fpcMotif
fpcMotif / lineBreaks.R
Created October 21, 2018 21:52 — forked from mollietaylor/lineBreaks.R
Line Breaks Between Words in Axis Labels in ggplot in R
library(OIdata)
data(birds)
library(ggplot2)
levels(birds$effect) <- gsub(" ", "\n", levels(birds$effect))
ggplot(birds,
aes(x = effect,
y = speed)) +
geom_boxplot() +
coord_flip()
@fpcMotif
fpcMotif / fit.R
Created October 21, 2018 21:52 — forked from mollietaylor/fit.R
ggplot or Lattice Fit Line in R
ols <- lm(Temp ~ Solar.R,
data = airquality)
summary(ols)
str(ols)
plot(Temp ~ Solar.R,
data = airquality)
abline(ols)
@fpcMotif
fpcMotif / factorDummies.R
Created October 21, 2018 21:51 — forked from mollietaylor/factorDummies.R
Compare Regression Results to a Specific Factor Level in R
str(ChickWeight$Diet)
table(ChickWeight$Diet)
ols <- lm(weight ~ Time + Diet,
data = ChickWeight)
summary(ols)
ChickWeight$Diet <- relevel(ChickWeight$Diet,
ref = 4)