Skip to content

Instantly share code, notes, and snippets.

@willurd
willurd / web-servers.md
Last active April 18, 2024 09:41
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@pklaus
pklaus / enumerate_interfaces.py
Last active March 15, 2024 15:32
Python: List all Network Interfaces On Computer
"""
Determine IPv4 addresses on a Linux machine via the socket interface.
Thanks @bubthegreat the changes to make it Py2/3 compatible and the helpful
code comments: https://gist.github.com/pklaus/289646#gistcomment-2396272
This version has all comments removed for brevity.
"""
import socket
import array
import struct
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@jonschoning
jonschoning / hw5.rkt
Created March 1, 2013 08:34
hw5.rkt
;; Programming Languages, Homework 5
#lang racket
(provide (all-defined-out)) ;; so we can put tests in a second file
;; definition of structures for MUPL programs - Do NOT change
(struct var (string) #:transparent) ;; a variable, e.g., (var "foo")
(struct int (num) #:transparent) ;; a constant number, e.g., (int 17)
(struct add (e1 e2) #:transparent) ;; add two expressions
(struct ifgreater (e1 e2 e3 e4) #:transparent) ;; if e1 > e2 then e3 else e4
@jtdowney
jtdowney / ecb.md
Last active September 1, 2020 20:06
Create ECB pattern images

This gist describes how to use the ImageMagick and OpenSSL command line tools to encrypt an image using ECB mode.

First we need to gather some information about the original image. This will tell us what size to use in our final step.

$ identify Braintree.png
Braintree.png PNG 898x229 898x229+0+0 8-bit sRGB 65KB 0.000u 0:00.000

Looks like the image is 898x229.

Next we need to convert the image into the RGBA format. This is a simple binary format that only contains uncompressed pixel data and no meta information, like image dimensions.

@cuibonobo
cuibonobo / README.md
Last active November 8, 2019 08:02
VGA Passthrough on virtual machines in CentOS 7

Mainline kernel

After your fresh CentOS 7 setup (make sure you install the QEMU/KVM virtualization tools and virt-manager), install the mainline kernel:

sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
sudo yum --enablerepo=elrepo-kernel install kernel-ml
sudo yum -y update