Skip to content

Instantly share code, notes, and snippets.

View pallavagarwal07's full-sized avatar
🙋‍♂️

Pallav Agarwal pallavagarwal07

🙋‍♂️
View GitHub Profile
@pallavagarwal07
pallavagarwal07 / wkhtmltopdf.sh
Created September 21, 2022 08:35 — forked from AnjaneyuluBatta505/wkhtmltopdf.sh
Install wkhtmltopdf with patched QT on Ubuntu Linux
# Uncomment the next line if you have installed wkhtmltopdf
# sudo apt remove wkhtmltopdf
cd ~
# Select an appropriate link for your system (32 or 64 bit) from the page https://wkhtmltopdf.org/downloads.html and past to the next line
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox*.tar.xz
sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin
sudo apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
@pallavagarwal07
pallavagarwal07 / auth.sh
Last active November 5, 2020 16:08
IITK firewall authentication script that uses nothing except for curl. It is possible to specify an interface manually (for compatibility with some unix systems). In case the user is already logged in, it can even force a logout to get the authentication page.
#!/bin/sh -eu
# Copyright 2017 Pallav Agarwal
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
{
{
name: "Pallav",
age: 19
},
{
name: "Kunal",
age: 20
},
{
Yes
OpenSCAD
ReactOS
Gentoo
No
https://gist.github.com/dufferzafar/efa128fca955d524be2907bb4d7347a6
[H[J[1;1H[?25l[m[H[J[1;1H[2;27HGNU GRUB version 2.02~beta2
[m[4;2H+----------------------------------------------------------------------------+[5;2H|[5;79H|[6;2H|[6;79H|[7;2H|[7;79H|[8;2H|[8;79H|[9;2H|[9;79H|[10;2H|[10;79H|[11;2H|[11;79H|[12;2H|[12;79H|[13;2H|[13;79H|[14;2H|[14;79H|[15;2H|[15;79H|[16;2H|[16;79H|[17;2H+----------------------------------------------------------------------------+[m[18;2H[19;2H[m Use the ^ and v keys to select which entry is highlighted.
Press enter to boot the selected OS, `e' to edit the commands
before booting or `c' for a command-line. [5;80H [7m[5;3H*Gentoo GNU/Linux [m[5;78H[m[m[6;3H Advanced options for Gentoo GNU/Linux [m[6;78H[m[m[7;3H [m[7;78H[m[m[8;3H [m[8;78H[m[m[9;

Kitchen Timetable

There are N students living in the dormitory of Berland State University. Each of them sometimes wants to use the kitchen, so the head of the dormitory came up with a timetable for kitchen's usage in order to avoid the conflicts:

  • The first student starts to use the kitchen at the time 0 and should finish the cooking not later than at the time A1.
  • The second student starts to use the kitchen at the time A1 and should finish the cooking not later than at the time A2.
  • And so on.
  • The N-th student starts to use the kitchen at the time AN-1 and should finish the cooking not later than at the time AN

The holidays in Berland are approaching, so today each of these N students wants to cook some pancakes. The i-th student needs Bi units of time to cook.

{
stdenv = { pkgs }: pkgs.stdenv //
{
mkDerivation = args: pkgs.stdenv.mkDerivation (args //
{
makeFlags = (if ( args ? makeFlags && args.makeFlags != null )
then args.makeFlags else []) ++ ["-j8" "-l8"];
});
};
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@pallavagarwal07
pallavagarwal07 / print_arr.c
Created August 27, 2015 09:53
Pretty print a 1D array.
void printArr(int n, int arr[]){
int i, j;
for(i=0; i<n; i+=10){
for(j=i; j<n && j<i+10; j++){
printf("%d\t", arr[j]);
}
printf("\n");
}
}
@pallavagarwal07
pallavagarwal07 / prime_list.c
Created August 27, 2015 09:52
Code to generate array of primes
int prime_list[N], len=0;
int seive[N];
void fillSieve(){
int i, j;
seive[0] = seive[1] = 1; // 0, 1 aren't primes
int n = sqrt(N);
i = 2;
for(j=2; i*j<N; j++)
seive[i*j] = 1;
for(i=3; i<=n; i+=2){