Skip to content

Instantly share code, notes, and snippets.

View adamallaf's full-sized avatar
👾

Adam Allaf adamallaf

👾
View GitHub Profile
; Author: Adam Allaf
; Date: 18.03.2016
; Description: 4-Byte signed integer calculator
; Version: 2.0
;------------------------------------------------------------------------------
#include "msp430.h" ; #define controlled include file
NAME main ; module name
PUBLIC main ; make the main label vissible
@adamallaf
adamallaf / analytic_wfm.py
Created February 10, 2017 10:30 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@adamallaf
adamallaf / peakdet.m
Created February 10, 2017 10:30 — forked from endolith/peakdet.m
Peak detection in Python
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.
#!/usr/bin/env python
import wave, struct
import numpy as np
import time
class DTMFDecoder:
DATA_TYPES = [None, "b", "<h", None, "<i"]
LOW_FREQUENCIES = [697.0, 770.0, 852.0, 941.0]
HIGH_FREQUENCIES = [1209.0, 1336.0, 1477.0, 1633.0]
@adamallaf
adamallaf / code.c
Created August 29, 2017 11:25
Comparing between two ways for up-down counting,
#include <msp430g2553.h>
int i = 0; // this should be unsigned
/* TA0CCR0 = power of 2 values only */
void __attribute__((interrupt(TIMER0_A0_VECTOR))) Timer0_A0_ISR(){
TA0CTL &= ~1;
i++;
int c = (i & (TA0CCR0 + 1)) - (i & TA0CCR0);
@adamallaf
adamallaf / lcd_off.sh
Created September 7, 2017 09:57
Bash scripts for RPI TFT 2.8"LCD backlight control
#!/bin/bash
sh /home/adam/control/lcd_pin_enable.sh
echo '0' > /sys/class/gpio/gpio508/value
@adamallaf
adamallaf / prog1.s
Last active January 3, 2018 02:41
Much Assembly Required manual control example
; Welcome to Much Assembly required!
; You will find useful information on the game here: https://github.com/simon987/Much-Assembly-Required/wiki
HWID_LEGS equ 0x0001
HWID_KEYBOARD equ 0x0004
HWID_DRILL equ 0x0005
HWID_HOLO equ 0x0009
HWID_BATTERY equ 0x000A
BATTERY_POLL equ 1
HOLO_DISP_HEX equ 1
@adamallaf
adamallaf / syslog_server.py
Created November 2, 2018 12:35
pySyslog Server
from datetime import datetime
from queue import Queue
from socketserver import BaseRequestHandler, UDPServer
from threading import Thread
class LogMessage:
__slots__ = ['client_ip', 'date', 'log']
def __init__(self):
@adamallaf
adamallaf / copy_emails.bas
Last active July 29, 2019 08:28
A macro for outlook.
Sub CopyEmailsToClipboard()
Dim clipboard As MSForms.DataObject
Dim sEmail As Object
Dim msg As String
Dim i As Integer
i = 0
Set clipboard = New MSForms.DataObject
For Each sEmail In ActiveExplorer.Selection
@adamallaf
adamallaf / respondtoselected.bas
Last active August 7, 2019 05:36
A VBA macro, creates a new email window to selected emails from the inbox.
Sub ResponToSelected()
Dim OutApp As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Recipient
Dim objRecipients As Recipients
Dim outlookNameSpace As Outlook.nameSpace
Dim sEmail As Object
Dim mRecipients As String
Dim i As Integer