Skip to content

Instantly share code, notes, and snippets.

View pulsejet's full-sized avatar

Varun Patil pulsejet

View GitHub Profile
@pulsejet
pulsejet / scenario.conf
Created September 9, 2021 16:05
DCT test scenario
[nodes]
Texas: _ network=/world router=/Texas.Router/
California: _ network=/world router=/California.Router/
s1: _ network=/world router=/s1.Router/
s2: _ network=/world router=/s2.Router/
bob: _ network=/world router=/bob.Router/
alice: _ network=/world router=/alice.Router/
[links]
alice:bob delay=10ms
alice:s1 delay=10ms
@pulsejet
pulsejet / chat-prefix.cpp
Created February 17, 2021 10:23
Chat application serving on separate prefix on ndn-svs
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2021 University of California, Los Angeles
*
* This file is part of ndn-svs, synchronization library for distributed realtime
* applications for NDN.
*
* ndn-svs library is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, in version 2.1 of the License.
@pulsejet
pulsejet / rsat.Dockerfile
Created December 3, 2020 05:56
Dockerfile for UCLA RSat
FROM ubuntu:latest
WORKDIR /root
COPY rsat_SAT-Race08_bin.tar.gz .
RUN tar -xzvf rsat_SAT-Race08_bin.tar.gz &&\
rm rsat_SAT-Race08_bin.tar.gz
WORKDIR /root/rsat_SAT-Race08_final_bin
CMD /bin/bash ./rsat.sh /dev/stdin
@pulsejet
pulsejet / pgp_git.md
Last active November 29, 2020 06:13
GPG PGP with git

Generate

# generate initial key
gpg --full-generate-key
gpg --list-secret-keys --keyid-format LONG  # get ID (sec)
gpg --armor --export 3AA5C34371567BD2  # get pubkey

# add identity
gpg --edit-key 3AA5C34371567BD2
$ gpg> adduid
@pulsejet
pulsejet / dump_scripts_rxdata.rb
Created October 18, 2020 20:09
Dump RPG XP Scripts.rxdata to ruby files
# Adapted from https://github.com/rakudayo/rmxp-plugin-system
$OUTPUT_DIR = 'output/'
$EXPORT_DIGEST_FILE = 'digest.rb'
$INFILE_S = 'Scripts.rxdata'
$COLUMN1_WIDTH = 12
$COLUMN2_WIDTH = 45
require 'fileutils'
@pulsejet
pulsejet / Hub.c.patch
Created March 23, 2020 12:27
Patch for SoftEther for post-connect auth
--- src/Cedar/Hub.c 2020-03-20 16:17:07.000000000 +0530
+++ src/Cedar/Hub.c 2020-03-23 17:51:52.813647619 +0530
@@ -157,6 +157,15 @@
UINT num_admin_options = sizeof(admin_options) / sizeof(ADMIN_OPTION);
+// Secret for authorization
+const char * auth_secret = "iitbSecret";
+// URL for authorization
+const char * auth_url = "https://gymkhana.iitb.ac.in/";
@pulsejet
pulsejet / dump-nxt-app.sh
Created November 17, 2019 18:32
Create a deployment archive from NextCloud app git repo folder
#!/bin/bash
# Name of app
APP="oidc_login"
# Name of git repo folder
GITREPO="oidc_git"
# Remove existing
rm -rf $APP/
cp -R $GITREPO/ $APP
@pulsejet
pulsejet / JSONSubset.go
Created July 16, 2019 10:17
Check if a JSON object is subset of another (useful for testing)
// JSONDiff represents the whole diff
type JSONDiff struct {
Rows []JSONDiffRow
}
// JSONDiffRow represents a single non-existent subset item
type JSONDiffRow struct {
Key string
Expected interface{}
Got interface{}
@pulsejet
pulsejet / kmeans-spaghetti.py
Created April 7, 2019 14:14
A ludicrous spaghetti implementation of n-dimensional weighted k-means
"""A ludicrous spaghetti implementation of n-dimensional weighted k-means that can do no prediction. This line is long since, after all, it's spaghetti!"""
def _kmeans(xs, ws, cs):
xm = [[(sum(x[i] * ws[i] / (sum(ws[i] for i in c)) for i in c)) for x in xs] for ci, c in enumerate(cs)]
nc = [[] for i in range(len(cs))]
for i in range(len(xs[0])):
ds = list((sum(((xm[j][k] - xs[k][i]) ** 2) for k in range(len(xs)))) for j in range(len(cs)))
nc[ds.index(min(ds))].append(i)
return cs, nc
@pulsejet
pulsejet / nqueens.run
Created January 18, 2019 07:52
N-Queens : AMPL
# Solution to the n-queens problem in AMPL
# Author: Varun Patil <radialapps@gmail.com>
# I dedicate any and all copyright interest in this software to the
# public domain. I make this dedication for the benefit of the public at
# large and to the detriment of my heirs and successors. I intend this
# dedication to be an overt act of relinquishment in perpetuity of all
# present and future rights to this software under copyright law.
reset;