Skip to content

Instantly share code, notes, and snippets.

View s0h1s2's full-sized avatar
🖥️
Building softwares for fun

Shkar Sardar s0h1s2

🖥️
Building softwares for fun
  • Looking for an opportunity
  • Lord's green earth
View GitHub Profile
@fnky
fnky / ANSI.md
Last active May 22, 2024 08:06
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@kthompson
kthompson / print_hex.asm
Last active August 15, 2022 15:52 — forked from jsutlovic/print_hex.asm
Assembly print hex
[org 0x7c00]
mov dx, 0x1fb7 ; Set the value we want to print to dx
call print_hex ; Print the hex value
jmp $ ; Hang once we're done
%include "print_string.asm"
; Prints the value of DX as hex.
print_hex:
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@brianmacarthur
brianmacarthur / flash-app.js
Last active July 10, 2023 18:41
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
@mycodeschool
mycodeschool / DoublyLinkedList.c
Created November 12, 2013 11:38
Doubly Linked List implementation in C
/* Doubly Linked List implementation */
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
struct Node* prev;
};