Skip to content

Instantly share code, notes, and snippets.

View ptsneves's full-sized avatar

Paulo Neves ptsneves

View GitHub Profile
@ptsneves
ptsneves / Makefile
Last active August 12, 2016 19:08
ubirch GmbH Assignment
.DEFAULT_GOAL:=bmp180
CC:=arm-none-eabi-gcc
CFLAGS=-I.
CPPFLAGS:=-c -Wall -g3 -fstack-check -ftrack-macro-expansion=0 \
-fno-diagnostics-show-caret
DEPS:= bmp180Driver.h bmp180Simulator.h
OBJ_DRIVER:= bmp180Driver.o
OBJ_TEST:= $(OBJ_DRIVER) main.o bmp180Simulator.o
@ptsneves
ptsneves / Find FIles in List of tars
Created December 15, 2016 09:33
Find file in lis of tars
(for f in `find $tar_dir -name '$tar_files*tar.gz'`; do (echo FILE $f && tar tvf $f ) ; done)|less
JPEG_FILE=./sample.jpeg for i in {1..10}; do exif ${JPEG_FILE} -t 0x0132 .jpg --ifd=1 --set-value="$(date +"%Y:%m:%d %H:%M:%S")" -o ./${i}.jpeg && sleep 1 done
@ptsneves
ptsneves / angelpassword.sh
Created January 7, 2018 19:03
Generates passowords with sha1sum with a master password and a salt like in http://www.angel.net/~nic/passwd.current.html
#!/bin/bash
if [ $# != 2 ]; then
echo "Usage: $0 <master password> <salt>"
exit 1
fi
#Puts it in the clipboard, at least in gnome
echo -n "$(echo -n $1:$2| sha1sum | cut -f1 -d\ | xxd -r -p | base64 | cut -c 1-13)@1a" | xclip -selection "clipboard"
#!/bin/bash -e
# <oldrev> <newrev> <refname>
#Adapted from
#https://github.com/olshanov/git-hooks/blob/master/pre-receive.deny-force-push-to-branches
while read oldrev newrev ref
do
if [[ "$oldrev" == "0000000000000000000000000000000000000000" ]]; then
#create new branch
continue;
fi
@ptsneves
ptsneves / serial-player.py
Last active May 20, 2019 19:13
Serial data sniffer with byte time stamp
#!/usr/bin/env python3
import argparse
import os
import pty
import time
def writeToPTY(fd, replay_time, byte_hex):
if not writeToPTY.next_send:
writeToPTY.next_send = replay_time + writeToPTY.send_period
@ptsneves
ptsneves / csl-remap.sh
Created June 23, 2019 21:08
CSL vertical mouse xinput map command to make side buttons also work as main buttons
#!/usr/bin/env bash
#the id 17 may be different
xinput set-button-map 17 1 2 3 4 5 6 7 3 1
A world where everything is about Jesus iconography. Cereal boxes have jesus figurines. Kinder eggs have a bible figure inside.
Scholars of harry potter need to pass through a decontamination shower with holy water, and have a Blade Runner kind of test but of Bible truths.
The Json base specification is based on the itemization of the 10 commendments and J stands for Jesus.
The pizzas are actually delivered in in tilled crosses, instead of triangles. So a box of pizza has several crosses arranjed.
Some piece of national security is deployed but works with interruptions and disruption
The interference comes from a place with snow and has some form of port for ice breakers. bleak town.
When we first arrive there nothing happens, its just a borring city, quite isolated. People are distrustful but we cannot investigate much further into the port and mine nearby.
One day there is an attempt at murdering us in cold day light, and other strange events start unraveling.
We report to our controllers what is happening, and the topic kind of escalates into a more serious matter, as there was no reason for such attack.
When trying to evacuate we are actively attacked by a professional mercenary group that seemed to work in the port. We are attacked and held for strange demands. Some of these demands make sense to me but others are almost surreal.
Some of the demands are related to state programs, both political as well as millitary that make little sense to be demanded.
We are released, with the expectation that t
@ptsneves
ptsneves / ChannelInputStream.cs
Last active May 3, 2020 14:39
A uni-directional stream that reads a byte[] Channel
using System;
using System.IO;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
namespace DroHub.Helpers.Thrift {
public class ChannelInputStream : Stream {
private readonly Channel<byte[]> _input_channel;
private MemoryStream _memory_stream;