Skip to content

Instantly share code, notes, and snippets.

@suyash
suyash / README.md
Last active July 23, 2016 04:10
Simpler PCP Build Instructions for Ubuntu 14.04

PCP Build on a fresh Ubuntu 14.04

  • qa/admin/check-vm does a system check
  1. dependencies
sudo apt-get -y install \
  autoconf \
  flex \
@suyash
suyash / README.md
Last active September 1, 2021 15:26
mmap examples

identical mmap programs in C and go

package main
import (
"bufio"
"fmt"
"os"
"path/filepath"
)
func replace(s string) string {
@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"
@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 / .gitignore
Last active September 21, 2016 14:42
grayscale converter
*.jpg
*.jpeg
*.png
*.gif
@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 / 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 / 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 / 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;