Skip to content

Instantly share code, notes, and snippets.

View sudoankit's full-sized avatar
📖
Reading.

Ankit sudoankit

📖
Reading.
View GitHub Profile
@sudoankit
sudoankit / linter.py
Last active March 22, 2021 15:49
Sublimelinter-gcc settings for MacOS Big Sur with gcc-10 installed using brew
class Gcc(Linter):
name = "gcc"
cmd = "gcc-10 ${args} -"
regex = OUTPUT_RE
multiline = True
on_stderr = None
defaults = {
"selector": "source.c",
"args": ["-c", "-Wall", "-O0"],
@sudoankit
sudoankit / .vimrc
Created December 17, 2020 13:47
Personal .vimrc
filetype off
filetype plugin indent on
syntax on
set modelines=0
set number
set ruler
set lazyredraw
@sudoankit
sudoankit / donutslow.c
Created October 22, 2020 08:59
A1k0n's Donut C Code (https://www.a1k0n.net/2006/09/15/obfuscated-c-donut.html) + I have edited the speed of the animation.
k;double sin()
,cos();main(){float A=
0,B=0,i,j,z[1760];char b[
1760];printf("\x1b[2J");for(;;
){memset(b,32,1760);memset(z,0,7040)
;for(j=0;6.28>j;j+=0.04)for(i=0;6.28
>i;i+=0.01){float c=sin(i),d=cos(j),e=
sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c*
h*e+f*g+5),l=cos (i),m=cos(B),n=s\
in(B),t=c*h*g-f* e;int x=40+30*D*
@sudoankit
sudoankit / NewTab-NoSurfTemplate.md
Last active August 23, 2020 19:27
New Tab - No Surf Template

How to use this?

  1. Save the HTML template (index.html) anywhere locally and open it using your favorite browser.
  2. Edit required fields/text etc using any simple text or better code/HTML editor. I use Sublime Text: https://www.sublimetext.com, a high quality, fast and FREE code editor (unlimited trialware like WinRAR).
  3. Now set the default homepage or new tab open with to this HTML file.
  4. Done!

Example:

Look at my comment below is an example (mine):

@sudoankit
sudoankit / 1209-lzy.cpp
Created April 17, 2020 17:20
Lazy caterer's sequence, Timus Online Judge: 1209 - 1, 10, 100, 1000...
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
long n;
cin >> n;
@sudoankit
sudoankit / odd_times.py
Created October 4, 2019 06:12
Number Occurring Odd Number of Times in O(n) using hash table
def find_it(seq):
hash = 0
for i in seq:
hash = hash ^ i # bitwise XOR
return hash
@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 ) ) )
;;
@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 / 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 / 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