Skip to content

Instantly share code, notes, and snippets.

View syfluqs's full-sized avatar

Subham Roy syfluqs

  • NITK Surathkal
  • India
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@syfluqs
syfluqs / 00_csr_details.txt
Last active September 23, 2018 05:54
Creating ca certificates for multiple hostnames
[req]
default_bits = 2048
prompt = no
default_md = sha256
req_extensions = v3_ca
distinguished_name = dn
[ca]
default_ca = CA_default
https://www.youtube.com/playlist?list=PLFuYI-BjuAtOBho9HP0aWVJZxWk_i_-Tz
https://www.youtube.com/playlist?list=PLFuYI-BjuAtNRo5yxtssIOyXFQ9dQhF2P
https://www.youtube.com/playlist?list=PLFuYI-BjuAtOfTx3GqqnlnXQVrM72lygg
https://www.youtube.com/playlist?list=PLFuYI-BjuAtM0ZHcwRrhW58Z7DpbvUxJA
https://www.youtube.com/playlist?list=PLFuYI-BjuAtN8WRk-wZzHxwzIjZ_EdHUI
https://www.youtube.com/playlist?list=PLFuYI-BjuAtMDTxAkSnkq_2cglS7dFEKc
https://www.youtube.com/playlist?list=PLFuYI-BjuAtOQjQvSD---teKT2PS4OjKb
https://www.youtube.com/playlist?list=PLFuYI-BjuAtN1ZOXGYRbmsW5uxFm5_M3m
// returns the first valid (long) integer value from the current position.
// lookahead determines how parseInt looks ahead in the stream.
// See LookaheadMode enumeration at the top of the file.
// Lookahead is terminated by the first character that is not a valid part of an integer.
// Once parsing commences, 'ignore' will be skipped in the stream.
long Stream::parseInt(LookaheadMode lookahead, char ignore)
{
bool isNegative = false;
long value = 0;
int c;
import os, sys
import _pickle as pickle
import record_class
DB_FILENAME = 'dbfile.db'
SCAN_DIR_NAME = '.'
SCAN_DEPTH = 1
master_dict = {}
@syfluqs
syfluqs / pid_controller.c
Last active December 19, 2023 21:48
A very basic PID controller in C
/*
* pid_controller.c
*
* Created on: Apr 24, 2016
* Author: subham roy
*/
#include "pid_controller.h"
double pid(PID_vars *vars, double current_err) {
TYPE_FILE = b'1'
TYPE_DIR = b'2'
class record:
__slots__ = ['name','extension','type','executable','callback','icon','abs_path']
def __init__(self, name, type, extension=None, executable=None, callback=None, icon=None, abs_path=None):
self.name = name
self.extension = extension
self.type = type
@syfluqs
syfluqs / cython_win_makefile.mak
Created June 20, 2017 06:16
A makefile for compiling python scripts to exe on windows.
PYTHONPATH:=C:\Python35
PYTHONLIB:=python35
.PHONY: build
build:
cython --embed $(file).py -o $(file).c
#Applying Wmain@16 linker error workaround patch
@sed 's/int wmain(int argc/int main(int argc/' $(file).c > cython_build_temp.c
gcc cython_build_temp.c -o $(file) -I $(PYTHONPATH)\include -L $(PYTHONPATH)\libs -l$(PYTHONLIB)
rm cython_build_temp.c
@syfluqs
syfluqs / relevance_vs_levenshtein.sh
Created June 18, 2017 08:04
Zsh script for comparing levenshtein performance
#!/bin/zsh
source=$1
q=$2
echo -n "Levenshtein : "
python -c "import time;import Levenshtein as L;s=time.time();ret=L.ratio('$source','$q');st=time.time()-s;print(round(ret,5),st)"
echo -n "Relevance : "
python -c "import os,time;os.chdir('../kupfer-master');from kupfer.core import relevance;s=time.time();ret=relevance.score('$source','$q');st=time.time()-s;print(round(ret,5),st)"
echo -n "Relevance + Levenshtein : "
import os
import time
import _pickle as pickle
master_list = []
TYPE_DIR = b'1'
TYPE_FILE = b'2'
def scan_files(dir_name, max_depth, current_depth=0):