Skip to content

Instantly share code, notes, and snippets.

🗿
Working on my synthesizer design

Jacek Wieczorek Jacajack

🗿
Working on my synthesizer design
Block or report user

Report or block Jacajack

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Jacajack
Jacajack / nsect.c
Last active Sep 23, 2019
N-section method benchmarking
View nsect.c
/*
Compile with: clang -O3 -o nsect nsect.c -Wall -DCOUNT=5000000 -DNSECT=? -funroll-loops
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <sys/time.h>
@Jacajack
Jacajack / makefile-arm
Created Jul 31, 2019
Old liblightmodbus makefile for STM32F103
View makefile-arm
# liblightmodbus - a lightweight, multiplatform Modbus library
# Copyright (C) 2017 Jacek Wieczorek <mrjjot@gmail.com>
# This file is part of liblightmodbus.
# Liblightmodbus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@Jacajack
Jacajack / iir.c
Last active Jul 14, 2019
IIR filter
View iir.c
struct iir_filter
{
float *w; // w coefficients
float *a; // a coefficients
float *b; // b coefficients
int n; // filter size
};
float iir_push( struct iir_filter *f, float x )
{
@Jacajack
Jacajack / packages-arch.csv
Last active Sep 27, 2019
My favorite programs (arch version) (not tested yet)
View packages-arch.csv
#Group Package name Description
sudo running programs as root
ssh remote shell
sshfs for mapping filesystems over network
pv program for measuring data flow through pipes
git version control system
moreutils more utilities
rsync for making backups and copying files
tree file tree view
rename powerful renaming utility
@Jacajack
Jacajack / host-patcher.sh
Last active Jun 27, 2019
/etc/hosts patch generator (based on StevenBlack repo)
View host-patcher.sh
#!/bin/bash
BLOCK="gambling porn fakenews social"
EXCEPT=""
cp hosts hosts.new
# Base
echo "blocking adware + malware..."
curl -s "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" | sed -ne '/# Start StevenBlack/,$p' >> hosts.new
@Jacajack
Jacajack / c_exceptions.c
Created May 4, 2019
C setjmp/longjmp based exception system
View c_exceptions.c
#include <setjmp.h>
#include <stdio.h>
union exception_data
{
const char *string;
double d;
int i;
};
@Jacajack
Jacajack / .clang-format
Created Apr 26, 2019
Almost satisfying clang-format-9 config file
View .clang-format
---
BasedOnStyle: LLVM
TabWidth: 4
IndentWidth: 4
UseTab: Always
ColumnLimit: 0
---
Language: Cpp
AccessModifierOffset: 0
@Jacajack
Jacajack / utils.md
Last active Nov 10, 2019
Cool commands I keep forgetting about
View utils.md

Cool commands I keep forgetting about

  • pandoc file.md -t beamer -o out.pdf - create beamer presentation from markdown file
  • nm - list symbols from object file
  • sending file with Xmodem (requires lrzsz):
    • screen /dev/tty* 115200
    • Ctrl + A, :exec !! sx file.txt
  • sudo getty -L 115200 ttyUSB0 vt102 - terminal over serial line (persistent)
  • objdump -D -b binary -mi386 -Maddr16,data16 -Mintel file.bin - disassemble raw 16-bit i386 binary file with Intel syntax
  • ffmpeg ... -vcodec hevc_nvenc/h264_nvenc - use Nvidia GPU for video encoding with ffmpeg
  • echo "file.txt" | entr command - run command each time file changes
@Jacajack
Jacajack / url_request.cpp
Created Apr 22, 2019
CURL-based, easy to use C++ URL request class
View url_request.cpp
#include "url_request.hpp"
#include <algorithm>
#include <stdexcept>
// The write callback function
size_t url_request::write_callback( void *contents, size_t size, size_t nmemb, void *userp )
{
size_t realsize = size * nmemb;
url_request *rq = static_cast<url_request*>( userp );
std::uint8_t *b = static_cast<std::uint8_t*>( contents );
@Jacajack
Jacajack / flags.md
Created Mar 12, 2019
My list of useful compilation flags
View flags.md

Warnings:

  • -Weverything - even more than -Wpedantic in Clang

Debugging:

  • -g - Preserve debugging symbols
  • -fno-omit-frame-pointer - if some symbols remain broken
  • -fno-builtin - Do not perform some printf, scanf, malloc, etc. optimizations (debugging is easier)
  • -fsanitize=address - Use address sanitizer
  • -fsanitize=thread - Use thread sanitizer
  • -fsanitize=undefined - Use UB sanitizer
You can’t perform that action at this time.