Skip to content

Instantly share code, notes, and snippets.

View kblomqvist's full-sized avatar

Kim Blomqvist kblomqvist

View GitHub Profile
@kblomqvist
kblomqvist / deserializer.cpp
Last active December 24, 2018 13:25
Deserialize bytes
#undef be16toh
void deserialize_u32(uint32_t &value, const uint8_t *bytes)
{
value =
(static_cast<uint32_t>(bytes[0]) << 24) |
(bytes[1] << 16) | (bytes[2] << 8) | bytes[3];
}
void deserialize_u24(uint32_t &value, const uint8_t *bytes)
"""
Usage: python scons2ecc.py > compile_commands.json
The MIT License (MIT)
Copyright (c) 2017 Kim Blomqvist
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
su root
apt-get install postgresql postgresql-client # cluster named as 'main' will be created automatically
adduser pgweb --disabled-login --disabled-password --shell /usr/sbin/nologin
apt-get install unzip
su pgweb -s /bin/bash
cd
wget https://github.com/sosedoff/pgweb/releases/download/v0.9.6/pgweb_linux_amd64.zip
unzip pgweb_linux_amd64.zip
mv pgweb_linux_amd64 pgweb
su root
aptitude install xorg openbox terminator iceweasel
pip install --upgrade pip
pip install --upgrade virtualenv
mount /dev/sr0 /media/cdrom
cd /media/cdrom
aptitude install linux-headers-$(uname -r) build-essential
sh ./VBoxLinuxAdditions.run
@kblomqvist
kblomqvist / eagle.scr
Created January 12, 2015 16:28
Eagle configs
# Uses ULP from https://raw.githubusercontent.com/Sns22/Eagle_PCB_Libraries/master/Eagle-ulp-files/toggle-layer.ulp
Set Drill 0.15;
Change Shape Round;
ASSIGN C+R 'Route';
ASSIGN A+R 'Ripup';
ASSIGN C+M 'Move';
ASSIGN C+G 'Group';
@kblomqvist
kblomqvist / githook-astyle.sh
Last active September 9, 2022 13:04
Git pre-commit hook to check C/C++ source file format using astyle (Artistic Style)
#!/bin/bash
# Installation:
# cd my_gitproject
# wget -O pre-commit.sh http://tinyurl.com/mkovs45
# ln -s ../../pre-commit.sh .git/hooks/pre-commit
# chmod +x pre-commit.sh
OPTIONS="-A8 -t8 --lineend=linux"
RETURN=0
@kblomqvist
kblomqvist / Vagrantfile.flask
Last active December 21, 2015 15:58
Vagrantfile to install flask
# -*- mode: ruby -*-
# vi: set ft=ruby :
# vagrant box add wheezy32 https://dl.dropboxusercontent.com/u/78793012/vagrantup/wheezy32.box
$provisioner = <<SCRIPT
echo "#!/bin/bash
function InstallPip {
if [ '$(which pip)' ]; then
echo '-- Already installed.'
return
@kblomqvist
kblomqvist / Vagrantfile.avr32
Last active December 19, 2015 00:39
Vagrantfile to install AVR32 Toolchain
# -*- mode: ruby -*-
# vi: set ft=ruby :
# vagrant box add wheezy32 https://dl.dropboxusercontent.com/u/78793012/vagrantup/wheezy32.box
$provisioner = <<SCRIPT
echo "#!/bin/bash
function InstallAVR32 {
if [ '$(which /opt/avr32-tools/bin/avr32-gcc)' ]; then
echo '-- Already installed.'
return
@kblomqvist
kblomqvist / dups3.sh
Created April 10, 2013 20:22
Duplicity backupper
#!/bin/sh
#
# Backuping
# ---------
# dups3 backup
#
# Restoring
# ---------
# dups3 restore /home/my/foo.txt ~/restore # Restore a file
# dups3 restore /home/my ~/restore # Restore a directory
@kblomqvist
kblomqvist / my.jekyllsite.com
Created April 10, 2013 07:49
Hosting Jekyll through Nginx
server {
index index.html;
location = / {}
location / { try_files $uri.html $uri/ /404.html =404; }
}