Skip to content

Instantly share code, notes, and snippets.

View sudoankit's full-sized avatar
📖
Reading.

Ankit sudoankit

📖
Reading.
View GitHub Profile
@sudoankit
sudoankit / insert_sort_mycodeschool_youtube.cpp
Last active December 20, 2015 15:24
The insertion sort using C++
#include<iostream>
using namespace std;
void insertion_sort(int A[],int n){
for(int i = 0 ; i < n ;i++){
int j,key; // I have taken hole as j. It's sounds better, anyways.
key = A[i];
j = i;
while(j > 0 && A[j-1] > key ){
A[j] = A[j-1]; //left shift
@sudoankit
sudoankit / test1.cpp
Last active March 23, 2016 18:58
sample test case for NIX npylib backend.
class npyExampleTestSuite : public Test::Suite
{
public:
npyExampleTestSuite()
{
TEST_ADD(ExampleTestSuite::f_test)
TEST_ADD(ExampleTestSuite::s_test)
}
private:
@sudoankit
sudoankit / c++Template.cpp
Created May 15, 2016 12:51 — forked from kodekracker/c++Template.cpp
Basic C++ Template for Competitive Programming
/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
* Example:- $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
/******** All Required Header Files ********/

Keybase proof

I hereby claim:

  • I am sudoankit on github.
  • I am sudoankit (https://keybase.io/sudoankit) on keybase.
  • I have a public key whose fingerprint is 743D AA67 1B6A 98CD EF36 FE6F BA90 CC4F 13B2 E43D

To claim this, I am signing this object:

@sudoankit
sudoankit / cv-compile.sh
Last active May 30, 2017 12:40
Shell script to compile OpenCV programs.
g++ `pkg-config --cflags --libs opencv` $1 -o $2 `pkg-config --cflags --libs opencv`
# $1 = yourprogram.cpp
# $2 = executable output name; yourprogram
# save the file in your directory
# $chmod +x cv-compile.sh
# $sh cv-compile $1 $2
# Caveats
@sudoankit
sudoankit / brewcv3.sh
Created June 24, 2017 07:47
Install OpenCV3 on MacOS with Python Support.
brew install opencv3 --with-contrib --with-python3 --c++11 --with-examples --with-ffmpeg --with-gphoto2 --with-gstreamer --with-jasper --with-java --with-opengl --with-qt5 --with-quicktime --with-vtk --with-tbb --HEAD
@sudoankit
sudoankit / djvu2pdf.sh
Created September 26, 2017 07:15
DJVU to PDF
#!/bin/bash
for i in *.djvu;
do ddjvu -format=pdf "$i" "${i/%.djvu/}.pdf" && rm $i
done
@sudoankit
sudoankit / repo-reset.md
Created September 1, 2018 11:49 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@sudoankit
sudoankit / ex1.1.scm
Last active February 14, 2019 10:32
Exercise 1.1 of SICP
MIT/GNU Scheme running under OS X
Copyright (C) 2014 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Image saved on Friday September 28, 2018 at 5:08:35 PM
Release 9.2 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/C 4.118
Edwin 3.116
@sudoankit
sudoankit / ex1.2.scm
Created February 14, 2019 10:42
My solution to Exercise 1.2 of SICP
;; Write the expression in prefix form.
;;
;; 5 + 4 + ( 2 - ( 3 - ( 6 + 4/5 ) ) )
;; -------------------------------------
;; 3 * ( 6 - 2 ) * (2 - 7 )
;;
;; A:
;; ( / ( + 5 4 (- 2 (- 3 (+ 6 (/ 4 5 ) ) ) ) )
;; ( * 3 (- 6 2 ) (- 2 7 ) ) )
;;