Skip to content

Instantly share code, notes, and snippets.

View sagarpanchal's full-sized avatar

Sagar Panchal sagarpanchal

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <semaphore.h>
#include <pthread.h>
#define N 5
#define THINKING 0
#define HUNGRY 1
#define EATING 2
su
chmod 751 /etc/default/ufw /lib/ufw/ufw-init /etc/ufw/ufw.conf /usr/sbin/ufw /etc/ufw/applications.d/ufw-bittorent /etc/ufw/applications.d/ufw-directoryserver /etc/ufw/applications.d/ufw-loginserver /etc/ufw/applications.d/ufw-dnsserver /etc/ufw/applications.d/ufw-proxyserver /etc/ufw/applications.d/ufw-webserver /etc/ufw/applications.d/ufw-chat /etc/ufw/applications.d/ufw-printserver /etc/ufw/applications.d/ufw-fileserver /etc/ufw/applications.d/ufw-mailserver
ufw enable && ufw default deny incoming && ufw default allow outgoing
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Functions
// Clear Screen
void reset(int a)
{
system("cls");
if (a > 0) printf("\n\n");
bajdzis.vscode-twig-pack
ban.spellright
bmewburn.vscode-intelephense-client
christian-kohler.path-intellisense
cjhowe7.laravel-blade
codingyu.laravel-goto-view
CoenraadS.bracket-pair-colorizer
dacoto.laravel-easy-blade-snippets
dbaeumer.jshint
dbaeumer.vscode-eslint
@sagarpanchal
sagarpanchal / userChrome.css
Last active November 13, 2019 06:13
Firefox userChrome
/* Remove circle and background and change padding, width and height from back button */
:root:not([uidensity="compact"]) #back-button > .toolbarbutton-icon {
background-color: unset !important;
border: unset !important;
padding: var(--toolbarbutton-inner-padding) !important;
border-radius: var(--toolbarbutton-border-radius) !important;
width: calc(2 * var(--toolbarbutton-inner-padding) + 16px) !important;
height: calc(2 * var(--toolbarbutton-inner-padding) + 16px) !important;
}
@sagarpanchal
sagarpanchal / phoneGap.sh
Created October 21, 2018 20:59
Run phoneGap on Ubuntu
#!/bin/bash
# cd to a directory where you want to install phoneGap
# and run following commands (or just download run this file with bash)
# https://github.com/phonegap/phonegap-app-desktop/commit/7a121fb96aef856cca36c6191778081e9d6317e5
# https://github.com/phonegap/phonegap-app-desktop/commit/5ad750815ddf51e6cc8e557f46afb455e288b92e
sudo apt-get install libgconf-2-4 &&
npm install -g grunt-cli &&
@sagarpanchal
sagarpanchal / ajaxCall.ts
Created November 13, 2019 12:38
JS Commons
interface IAjaxCall {
error: boolean;
status: number;
data: any;
}
/**
* async api call helper
* @param func function that'll return promise
*/
export class Action {
constructor(type) {
this.type = type;
}
emit(detail) {
const event = new CustomEvent(this.type, { detail });
window.dispatchEvent(event);
}
@sagarpanchal
sagarpanchal / number.proto.js
Created September 30, 2021 07:20
number.proto.js
Object.defineProperty(Number.prototype, 'decimal', {
get: function decimal() {
Number.precision = 'precision' in Number ? Number.precision : 3;
const f = Math.pow(10, Number.precision);
return Math.round(this * f) / f;
},
});
@sagarpanchal
sagarpanchal / stickTableColumns.js
Created November 24, 2021 12:39
Stick Table Columns
const stickyIndex = 5;
const rows = document.querySelectorAll("table tr");
const cellSlice = Array.prototype.slice.call(rows[0].children, 0, stickyIndex);
const widthList = Array.prototype.map.call(cellSlice, (cell) => cell.offsetWidth);
const leftOffsetList = widthList.map((_, index) => {
const output = -10;
for (let i = 0; i < index; i++) output = output + (widthList[i] - 1);
return output;
});