Skip to content

Instantly share code, notes, and snippets.

View vireshas's full-sized avatar
:octocat:

Viresh Sanagoudar vireshas

:octocat:
View GitHub Profile
@jgrahamc
jgrahamc / pwnd.js
Created February 24, 2018 16:36
Cloudflare Workers that adds an "Cf-Password-Pwnd" header to a POST request indicating whether the 'password' field appears in Troy Hunt's database of pwned passwords.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckPassword(event.request))
})
async function fetchAndCheckPassword(req) {
if (req.method == "POST") {
try {
const post = await req.formData();
const pwd = post.get('password')
const enc = new TextEncoder("utf-8").encode(pwd)
@creack
creack / main.go
Created January 7, 2018 17:30 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@F21
F21 / raft.go
Created November 15, 2017 05:05
Sample hashicorp/raft + hashicorp/serf app
package main
import (
"crypto/md5"
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"
@bishboria
bishboria / springer-free-maths-books.md
Last active November 27, 2024 12:11
Springer made a bunch of books available for free, these were the direct links
@iamralch
iamralch / compress.go
Last active April 16, 2023 03:04
ZIP archives in Golang
import (
"archive/zip"
"io"
"os"
"path/filepath"
"strings"
)
func zipit(source, target string) error {
zipfile, err := os.Create(target)
@iamralch
iamralch / ssh_client.go
Last active August 21, 2024 05:26
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"
<html>
<head>
<script type="text/javascript" src="http://cdn.clappr.io/latest/clappr.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/clappr.rtmp/0.0.2/rtmp.min.js"></script>
</head>
<body>
<div id="player"></div>
<script>
window.onload = function() {
var player = new Clappr.Player({
@vireshas
vireshas / detect_utf8.c
Last active August 29, 2015 13:57
Detect no,of utf-8 chars in a line
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//utf-8 chars can be 4bytes long
#define U_MAX_BYTES 4
//counter to hold non ascii chars count
int count = 0;
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git