Skip to content

Instantly share code, notes, and snippets.

@ezimuel
ezimuel / sign.sh
Created March 14, 2016 15:50
Sign and verify a file using OpenSSL command line tool. It exports the digital signature in Base64 format.
#!/bin/bash
# Sign a file with a private key using OpenSSL
# Encode the signature in Base64 format
#
# Usage: sign <file> <private_key>
#
# NOTE: to generate a public/private key use the following commands:
#
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem
@anvaka
anvaka / 00.Intro.md
Last active July 18, 2024 03:09
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@dmitry-vsl
dmitry-vsl / spa_2016_proposal.md
Created September 11, 2015 22:01
Архитектура средненагруженных single page application приложений в 2016 году

Клиент

На клиенте используем стэк фейсбука:

  • React.js. Один из самых популярных javascript фреймворков, интегрированный с остальными частями facebook-стэка.
  • GraphQL. Протокол для доступа к данным, который адресует недостатки REST API.
  • Relay. Клиентская библиотека для удобной работы с grapqhl-сервером.
  • Flow type. Типизированное надмножество javascript, умеет выводить анонимные типы из graphql-запросов используя grapqhl-схему.

Сервер

На сервере используем:

@jrgcubano
jrgcubano / gist:56e3204ecc661b09c16a
Last active August 13, 2017 12:51
Facial recognition and training with node js
// Starkflow comments + github project node js
// + https://github.com/jrgcubano/face-detection-node-opencv
// + http://blog.stevenedouard.com/stroll-node-facial-recognition-3rd-party-apis/
I believe that you're using the node-opencv library ? You will need some more steps. You have to train your opencv system which than allows you to use the method "predictSync" from FaceRecongizer().
The node-opencv library has a FaceRecognizer Object which you first initialize.
Initialize FaceRecognizer: var FaceRecognizer = new cv.FaceRecognizer();
You have to read all the images, create a specific array and train your FaceRecognizer with that. For my purpose, I'm saving each user in a DB and they get a unique ID which I'm using to create a specific subfolder and this is later used. Here is my code:
@codedokode
codedokode / Особенности сравнения строк.md
Last active March 30, 2021 12:05
Особенности сравнения строк

Эта статья перенесена сюда: https://github.com/codedokode/pasta/blob/master/php/collation.md Ниже идет старая, неподдерживаемая версия статьи.


В программировании строки можно сравнивать. При этом обычно подразумевается алфавитное сравнение, то есть меньше то слово, которое идет раньше по алфавиту. Если начальные буквы совпадают, то меньше то слово, которое короче. Например, "аббат" < "аккорд", "кот" < "котёнок".

Если разобраться в теме сравнения строк на любых языках (а не только на русском), то все выглядит гораздо сложнее и появляется много особенностей, которые надо учитывать(по-английски эта тема называется «collation»). И проблема не в том, что там много букв из разных алфавитов, а в том что одни и те же буквы имеют разный порядок в разных языках. Например, буквы с точечками и черточками сравниваются по-разному: http://en.wikipedia.org/wiki/Alphabetical_order#Language-specific_conventions

В некоторых языках буквы вроде å идут после z, в некоторых между a и b. В некорых (английский) они им

@brianc
brianc / gist:f906bacc17409203aee0
Last active December 22, 2023 00:47
Some thoughts on node-postgres in web applications

Some thoughts on using node-postgres in a web application

This is the approach I've been using for the past year or so. I'm sure I'll change and it will change as I grow & am exposed to more ideas, but it's worked alright for me so far.

Pooling:

I would definitely use a single pool of clients throughout the application. node-postgres ships with a pool implementation that has always met my needs, but it's also fine to just use the require('pg').Client prototype and implement your own pool if you know what you're doing & have some custom requirements on the pool.

@davidjgraph
davidjgraph / gist:9d997cdf81f438bbd725
Created July 29, 2014 13:27
explore.js draw.io plugin
/**
* Explore plugin.
*/
Draw.loadPlugin(function(ui)
{
// Adds resource for action
mxResources.parse('exploreFromHere=Explore from here...');
// Max number of edges per page
var pageSize = 20;
@itayw
itayw / HISTORY.md.js
Last active August 12, 2020 17:16
Generate HISTORY.md from GitHub Milestones and Tags
/**
Build HISTORY.md from your GitHub Tags and Milestones.
Note: Tag and Milestone name/title MUST MATCH!
**/
var
GitHubApi = require('github'),
async = require('async'),
fs = require('fs'),