Skip to content

Instantly share code, notes, and snippets.

@suyash
suyash / jfsStore.js
Last active May 12, 2020 07:21
MemoryStore + JFSStore
import { Store } from 'express-session';
import JFS from 'jfs';
export default class JFSStore extends Store {
constructor(location) {
super();
this.db = new JFS(location || 'data');
}
@suyash
suyash / README.md
Last active October 12, 2017 21:29
Pocket API authentication demo
go run main.go -key ...

and go to http://localhost:4343/login

@suyash
suyash / .gitignore
Last active September 5, 2017 14:15
synth
*.mp3
@suyash
suyash / client.c
Created January 2, 2017 16:36
TCP echo client-server in C
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
int main() {
const char* server_name = "localhost";
const int server_port = 8877;
@suyash
suyash / client.c
Created January 2, 2017 15:53
UDP echo client-server implementation
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
int main() {
const char* server_name = "localhost";
const int server_port = 8877;
@suyash
suyash / README.md
Last active December 15, 2016 14:05
shared_mutex

< C++17

run shared_mutex.cc -lboost_system -lboost_thread -lpthread -std=c++14

C++17

CXX=g++-6 run shared_mutex.cc -lpthread -std=c++17
@suyash
suyash / README.md
Last active October 14, 2016 14:08
cin vs scanf

ubuntu 14.04, g++ 4.8

81.700000, 187.500000

ubuntu 14.04, clang++-3.8

76.400000, 186.800000
@suyash
suyash / .gitignore
Last active September 21, 2016 14:42
grayscale converter
*.jpg
*.jpeg
*.png
*.gif
@suyash
suyash / main.go
Created August 25, 2016 14:11
vscode snippets to UltiSnips
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@suyash
suyash / convert.go
Created August 4, 2016 15:14
convert atom snippets to vscode snippets
package main
import (
"bytes"
"encoding/json"
"flag"
"io/ioutil"
"os"
"regexp"
"strings"