Skip to content

Instantly share code, notes, and snippets.

@hirrolot
hirrolot / CoC.ml
Last active April 17, 2025 05:06
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)
@jthomas
jthomas / package.json
Last active September 24, 2023 21:58
Using TensorFlow.js with MobileNet models for image classification on Node.js
{
"name": "tf-js",
"version": "1.0.0",
"main": "script.js",
"license": "MIT",
"dependencies": {
"@tensorflow-models/mobilenet": "^0.2.2",
"@tensorflow/tfjs": "^0.12.3",
"@tensorflow/tfjs-node": "^0.1.9",
"jpeg-js": "^0.3.4"
@zmts
zmts / tokens.md
Last active April 18, 2025 15:23
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@dca
dca / mongoose-debug.js
Created June 8, 2015 12:26
Enable Mongoose Debug Mode
/*
* mongoose 除錯模式
* */
if ( /mongoose/.test(process.env.DEBUG) ){
mongoose.set('debug', true);
}
@gorborukov
gorborukov / russia
Last active April 1, 2025 11:46
Регионы и города россии в формате JSON
[
{
"region": "Москва и Московская обл.",
"city": "Москва"
},
{
"region": "Москва и Московская обл.",
"city": "Абрамцево"
},
@npow
npow / gist:2902211
Created June 9, 2012 19:10
NodeJS return image
var http = require('http')
, fs = require('fs');
fs.readFile('image.jpg', function(err, data) {
if (err) throw err; // Fail if the file can't be read.
http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'image/jpeg'});
res.end(data); // Send the file data to the browser.
}).listen(8124);
console.log('Server running at http://localhost:8124/');