Skip to content

Instantly share code, notes, and snippets.

View basnijholt's full-sized avatar

Bas Nijholt basnijholt

View GitHub Profile
@Lewiscowles1986
Lewiscowles1986 / rPi3-ap-setup.sh
Last active March 31, 2025 15:46
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
@kracekumar
kracekumar / ws_app.py
Last active September 5, 2024 17:04
Simple websocket server with uvloop.
# -*- coding: utf-8 -*-
import asyncio
import uvloop
from aiohttp.web import Application, MsgType, WebSocketResponse
def add_socket(app, socket, user_id):
if user_id in app['connections']:
pass
@lukasbesch
lukasbesch / disk-conversion-progress.sh
Last active March 31, 2022 15:52
View progress of long-running disk conversion tasks (en-/decryption) on macOS / OS X
function displaytime {
local T=$1
local D=$((T/60/60/24))
local H=$((T/60/60%24))
local M=$((T/60%60))
local S=$((T%60))
(( $D > 0 )) && printf '%3s' $D && printf ' days '
(( $H > 0 )) && printf '%2s' $H && printf ' hours '
(( $M > 0 )) && printf '%2s' $M && printf ' minutes '
if [ $D -lt 1 -a $H -lt 1 ]
@TySkby
TySkby / timeout.py
Last active June 5, 2024 17:06
Timeout decorator/context manager using signals (for Python 3)
#!/usr/bin/env python3
"""Easily put time restrictions on things
Note: Requires Python 3.x
Usage as a context manager:
```
with timeout(10):
something_that_should_not_exceed_ten_seconds()
```
@mtrovilho
mtrovilho / Aircrack Commands
Last active March 3, 2025 15:02 — forked from victorreyesh/Aircrack Commands
Cracking WPA2 / WEP Wifi / Aircrack 10 seconds guide. For Mac OSX
// Install the latest Xcode, with the Command Line Tools.
// Install Homebrew
// Install aircrack-ng:
brew install aircrack-ng
// Create the following symlink:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/sbin/airport
// Figure out which channel you need to sniff:
sudo airport -s

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to ExpressVPN.

This is adapted from SuperJamie's gist.

Requirements

I used a Raspberry Pi 3 - seems like the extra speed may be useful for running VPN.

@luiscape
luiscape / install_packages.sh
Created January 16, 2017 14:36
Install Python dependency packages from requirements.txt using conda.
#
# Original solution via StackOverflow:
# http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t
#
#
# Install via `conda` directly.
# This will fail to install all
# dependencies. If one fails,
# all dependencies will fail to install.
@aeantipov
aeantipov / kwant_wsl.md
Last active May 18, 2019 17:31
Kwant WSL installation

Kwant WSL (Linux subsytem for Windows) installation

Prerequisites for installation: Windows 10 (updates after September 2016) and Linux subsystem for windows. Linux subsystem is in fact Ubuntu 14.04 Trusty, so the instructions are similar. One could in fact use ubuntu instructions (via sudo apt-get install python3-numpy or pip3 install numpy), but the performance would be suboptimal. In order to get optimal perfomance, one needs to compile LAPACK libraries and numpy/scipy. Two ways are possible: manual installation and package manager (spack).

Spack installation

This way of installation has not been tested, but should be easier to do. Since we don't need binaries and ubuntu trusty is old, one needs a source package manager.

@BretStateham
BretStateham / cloud-init-azmobyedge-bionic.yaml
Last active February 28, 2024 13:32
Create an Ubuntu 18.04 VM in Azure and provision it with the Azure CLI, Moby and the Azure IoT Edge Runtime using Cloud-Init
#cloud-config
apt_sources:
- source: "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ bionic main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.7 (GNU/Linux)
mQENBFYxWIwBCADAKoZhZlJxGNGWzqV+1OG1xiQeoowKhssGAKvd+buXCGISZJwT
LXZqIcIiLP7pqdcZWtE9bSc7yBY2MalDp9Liu0KekywQ6VVX1T72NPf5Ev6x6DLV
7aVWsCzUAF+eb7DC9fPuFLEdxmOEYoPjzrQ7cCnSV4JQxAqhU4T6OjbvRazGl3ag