This file contains hidden or 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 <libusb.h> | |
#include <assert.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
libusb_init(NULL); | |
libusb_device_handle *handle; | |
assert(handle = libusb_open_device_with_vid_pid(NULL, 0x0483, 0x5740)); |
This file contains hidden or 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
PREFIX=/usr/bin/arm-none-eabi | |
CC=gcc | |
OBJCOPY=objcopy | |
TARGET=STM32F3 | |
STFLASH=st-flash | |
%.o: %.c | |
$(PREFIX)-$(CC) -O0 -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -MD -Wall -Wundef -I../third-party/libopencm3/include -D$(TARGET) -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -gdwarf-2 -g3 -o $@ -c $< | |
%.elf: %.o |
This file contains hidden or 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 | |
FFMPEG=~/bin/ffmpeg/ffmpeg | |
FILE=$1 | |
$FFMPEG -threads 0 -i $FILE -vf vidstabdetect=stepsize=6:shakiness=10:accuracy=15:result=$FILE.trf -f null - | |
$FFMPEG -threads 0 -i $FILE -vf vidstabtransform=input=$FILE.trf:smoothing=30 -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 256k $FILE.stab.mp4 |
This file contains hidden or 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 <stdio.h> | |
#include <string.h> | |
#include <stdarg.h> | |
/* Composes a string accordingly to format with correctly escaping JSON literals. | |
* Correctly fails when runs up of output buffer space. | |
* Replaces all occurences of ' with " in format string for convenience. | |
* Terminates a string with '\0'. | |
* Format specifiers: | |
* %% - literally '%' |
This file contains hidden or 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
/* Canonicalize virtual path | |
* License: public domain | |
*/ | |
void canonicalize(const char *path, char *output) { | |
do { | |
while(path[0] == '/') path++; | |
char *chunk_end = strchr(path, '/'); | |
int chunk_length = chunk_end ? chunk_end - path : strlen(path); |
This file contains hidden or 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
/* | |
* @seed: 20 bytes | |
* @result: 120 bytes (but use first 107 bytes only) | |
*/ | |
int mgf1(char *seed, BYTE *result) | |
{ | |
int hlen = 20; | |
int length = 127 - hlen; | |
int i, d = 0; |
This file contains hidden or 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 <stdio.h> | |
#include <gtkhotkey.h> | |
void hotkey_activated_callback (GtkHotkeyInfo *hotkey, guint event_time, void *data) | |
{ | |
g_message("activated"); | |
} | |
int main(int argc, char **argv) | |
{ |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <ftdi.h> | |
#include <assert.h> | |
#include <math.h> | |
/* | |
* Input: RxD | |
* OUT0: CTS |
This file contains hidden or 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
dissect :: (Data a, Data d) => a -> [(String, Maybe d)] | |
dissect a = zip (constrFields $ toConstr a) (gmapQ cast a) |
This file contains hidden or 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 <functional> | |
using namespace std; | |
class Test | |
{ | |
public: | |
Test(); | |
void say_hello(string way); | |
private: |
NewerOlder