Skip to content

Instantly share code, notes, and snippets.

@matrixd
matrixd / gist:a5823215d36d55b9c53c
Created July 13, 2014 00:14
Ascii string to uint
uint8_t strToUint8(uint8_t length, uint8_t *charseq){
uint8_t res = 0;
uint8_t n = 0;
while(length) {
length -= 1;
res += charseq[n] - 0x30 + (length*10);
n++;
};
return res;
}
>utox_updater.exe
detected 64bit system
getaddrinfo failed
@matrixd
matrixd / bug
Last active August 29, 2015 14:05
stm32f4xx.h bug
There is a bug in stm32f4xx.h file.
That file can be found in "Libraries/CMSIS/Device/ST/STM32F4xx/Include/" in packages:
"STSW-STM32127" for STM32F401VC
"STSW-STM32136" for 32F401CDISCOVERY.
Here is a declaration of GPIO_TypeDef structure.
typedef struct
{
__IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */
@matrixd
matrixd / gist:b9a875717fa1950db03f
Last active November 4, 2022 15:34
Import all torrents from deluge to transmission
import os
import re
#it's supposed that you are in "state" directory
#~/.config/deluge/state
f = open("torrents.state")
buf = f.read()
f.close()
p = re.findall("sg21\\nS\'([^']+)", buf)
t = re.findall("sg25\\nS\'(\w+)\'", buf)
@matrixd
matrixd / .asoundrc
Last active December 3, 2015 16:28
.asoundrc
pcm.!default {
type plug
slave.pcm "dmix:DS,0"
}
/**
******************************************************************************
* @file usbd_cdc_vcp.c
* @author MCD Application Team
* @version V1.0.0
* @date 22-July-2011
* @brief Generic media access Layer.
******************************************************************************
* @attention
*
@matrixd
matrixd / gist:ce5c8026933e5fc9f583
Created August 10, 2015 13:46
Rename all .h to .hpp
for f in $(ls *.h)
do
mv $f ${f%%.h}".hpp"
done
@matrixd
matrixd / win7.xml
Last active November 8, 2015 18:10
win7 kvm
<domain type='kvm'>
<name>win7</name>
<uuid>109227f0-620d-08e6-f4a0-a6ab434d8438</uuid>
<description>Test VM</description>
<memory unit='KiB'>3906250</memory>
<currentMemory unit='KiB'>3906250</currentMemory>
<vcpu placement='static'>4</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
<boot dev='hd'/>
@matrixd
matrixd / .vimrc
Created December 1, 2015 14:02
vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@matrixd
matrixd / WD10EZEX.txt
Created December 13, 2015 21:48
smartctl output
sudo smartctl -a /dev/sda
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.2.5-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Western Digital Blue
Device Model: WDC WD10EZEX-00KUWA0
Serial Number: WD-WCC1S4714769
LU WWN Device Id: 5 0014ee 25e01ec3b
Firmware Version: 15.01H15