Keybinding | Action |
---|---|
Alt + f/b | Move cursor to previous/next word |
Ctrl + a/e | Move cursor to beginning/end of command |
Ctrl + xx | Toggle between the start of line and current cursor position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdbool.h> | |
// Defines | |
#define CBT_MIN(a, b) ((a) < (b) ? (a) : (b)) | |
// Checks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Default value for days | |
DAYS=7 | |
# Check if a custom number of days is provided as an argument | |
if [ "$1" ]; then | |
DAYS=$1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allow mouse interaction | |
set -g mouse on | |
# Don't rename windows automatically | |
set-option -g allow-rename off | |
# Use C-a instead of C-b | |
unbind C-b | |
set-option -g prefix C-a | |
bind-key C-a send-prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import sys | |
from enum import Enum | |
""" protocol-decoder.py <saleae csv file> | |
Takes in an exported csv file from the Saleae logic2 software, where the SPI analyzer was used to trace communication with an enc28j60 ethernet | |
chip from Microchip, and produces the instructions and responses the communication represents. | |
- Software resets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socket import socket, AF_PACKET, SOCK_RAW | |
ETH_P_ALL = 0x0003 | |
print("Starting") | |
interface = "enx7cc2c65485c0" | |
# interface_mac = 7c:c2:c6:54:85:c0 | |
# Note: When sending ethernet frames, only the following data is actually supplied at this level: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# Generate a lowpass filter using a windowed sinc function | |
def sinc(x): | |
if x == 0: | |
return 1 | |
return math.sin(math.pi * x) / (math.pi * x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# X_k = \sum_{n=0}^{N-1} x_n \cdot e^{-\frac{j 2 \pi k n}{N}} | |
# X_k = \sum_{n=0}^{N-1} x_n \cdot [\cos(-\frac{2 \pi k n}{N}) + j\sin(-\frac{2 \pi k n}{N})] | |
import math | |
import cmath | |
def generate_data(timespan=64): | |
data = [] | |
for i in range(timespan): | |
ni = i/timespan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import sys | |
import subprocess | |
callgrind_file = sys.argv[1] | |
executable_file = sys.argv[2] | |
if len(sys.argv) < 3: | |
print("Usage: fix-callgrind.py <callgrind file> <executable>") | |
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "machine.h" | |
void state_machine_step(state_machine_t* descriptor) { | |
state_transition_t* transition; | |
uint32_t current_state = *descriptor->state_index; | |
for (uint32_t i = 0; i < descriptor->num_transitions; i++) { | |
transition = &descriptor->transitions[i]; | |
if ((transition->from_state == current_state) && (transition->condition(current_state))) { | |
descriptor->on_state_change(current_state, transition->to_state); |
NewerOlder