Skip to content

Instantly share code, notes, and snippets.

View Lewiscowles1986's full-sized avatar
🤓

Lewis Cowles Lewiscowles1986

🤓
View GitHub Profile

In a terminal start a server.

$ python -m SimpleHTTPServer 8000

In another terminal set up the cgroups freezer.

@AlexNDRmac
AlexNDRmac / phpenv-install.md
Last active February 13, 2024 04:17 — forked from sergeyklay/phpenv-install.md
Multiple PHP versions using phpenv and php-build

Multiple PHP versions using phpenv and php-build

Install dependecies

Debian/Ubuntu users

sudo apt install \
  autoconf \
 bison \
@Savelenko
Savelenko / GADTMotivation.fs
Last active February 9, 2024 12:00
Motivated simulation of GADTs in F#, quite motivational
module GADTMotivation
(*
Here is a simple motivational example for GADTs and their usefulness for library design and domain modeling. Suppose we
need to work with settings which can be displayed and adjusted in a GUI. The set of possible setting "types" is fixed
and known in advance: integers, strings and booleans (check-boxes).
The GUI should show an example value for each possible setting type, e.g. 1337 for an integer setting and "Hello" for a
string setting. How can we model this small domain of setting types and computing example values?
*)
@kafran
kafran / extract_har.py
Last active November 3, 2023 20:04
Python 3 script to extract images from HTTP Archive (HAR) files
import json
import base64
import os
# make sure the output directory exists before running!
folder = os.path.join(os.getcwd(), "imgs")
with open("scr.har", "r") as f:
har = json.loads(f.read())
@Lewiscowles1986
Lewiscowles1986 / rPi3-ap-setup.sh
Last active July 16, 2023 15:33
Raspberry Pi 3 access-point-setup
#!/bin/bash
#
# This version uses September 2017 august stretch image, please use this image
#
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
#!/bin/bash
# program-specific xbindkeys bindings
# there's a tool called `autokey`, which does this, but unlike xbindkeys, it doesn't catch mouse buttons
# doesn't interfere with main xbindkeys
# `pacman -S xbindkeys xdotool`
# `sleep 3 && cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm`
@keeferrourke
keeferrourke / install-google-fonts.sh
Last active May 22, 2023 12:38
A bash script to install all Google Fonts, system wide, on debian based systems (ex. Ubuntu)
#!/bin/sh
# Written by: Keefer Rourke <https://krourke.org>
# Based on AUR package <https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-google-fonts-git>
# dependancies: fonts-cantarell, ttf-ubuntu-font-family, git
sudo apt-get install fonts-cantarell ttf-ubuntu-font-family git
srcdir="/tmp/google-fonts"
pkgdir="/usr/share/fonts/truetype/google-fonts"
giturl="git://github.com/google/fonts.git"
[SECTION .text]
global _start
_start:
jmp short getData
execIt:
pop ebx ;Get the string off stack
xor eax,eax ;Clear eax
mov [ebx+8],al ;This helps us to avoid having a zero byte in our code.
;It sets the terminator to the string.
push eax ;Second argument for WinExec
@tfeldmann
tfeldmann / vector.py
Created June 16, 2016 13:48
A fast, feature-rich and easy-to-use python 2D vector class based on complex numbers
""" A python 2D vector class based on complex numbers
"""
import cmath
class Vector(complex):
@classmethod
def fromPolar(cls, r, phi):
return cls(cmath.rect(r, phi))
@xrstf
xrstf / letsencrypt.md
Last active April 18, 2023 05:01
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple: