Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrik Dahlström Risca

View GitHub Profile
View axp209_control_functions.sh
#!/usr/bin/env bash
function enable_2v_adc_on_gpio0 {
# docs: http://dl.linux-sunxi.org/AXP/AXP209_Datasheet_v1.0en.pdf
v=$(i2cget -f -y 0 0x34 0x83 b)
/usr/sbin/i2cset -f -y 0 0x34 0x83 $((v&0xF7)) # disable ADC input on GPIO0
/usr/sbin/i2cset -f -y 0 0x34 0x90 0x04 # set GPIO0 to 12 bit ADC input
u=$(i2cget -f -y 0 0x34 0x85 b)
# /usr/sbin/i2cset -f -y 0 0x34 0x85 $((u|0x01)) # set ADC input range to 0.7-2.7475v
/usr/sbin/i2cset -f -y 0 0x34 0x85 $((u&0xFE)) # set ADC input range to 0-2v
@Risca
Risca / notes
Created May 26, 2017
death gate notes
View notes
.PIC: Images and other stuff
Begins with header with info on all contained files. Last header entry is blank (all zeros):
4 bytes - Offset to file
2 bytes - Type:
0x0300 == closed book or runes,
0x0500 == navigation images and items,
0x1300 == note, open book, spell casting interface, or frame around embedded video,
0x1500 == big static image,
0x4501 == some kind of overlay images to big images,
3*2 bytes - Type specific data/arguments
View compare_disks.c
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CHUNK_SIZE (512*1024)
#define START_GB ((off_t)2928) // ~13 % of 22 TB
int main(int argc, char* argv[])
{
@Risca
Risca / unix_ipv6_support.patch
Created Jun 11, 2013
IPv6 support for Linux Synergy (tested on Sabayon Linux)
View unix_ipv6_support.patch
diff -uNr synergy-1.4.10-Source.orig/src/lib/arch/CArchNetworkBSD.cpp synergy-1.4.10-Source/src/lib/arch/CArchNetworkBSD.cpp
--- synergy-1.4.10-Source.orig/src/lib/arch/CArchNetworkBSD.cpp 2012-04-06 19:52:29.000000000 +0200
+++ synergy-1.4.10-Source/src/lib/arch/CArchNetworkBSD.cpp 2012-11-13 17:47:14.224995060 +0100
@@ -49,7 +49,8 @@
static const int s_family[] = {
PF_UNSPEC,
- PF_INET
+ PF_INET,
+ PF_INET6,
View C++ magix
#include <vector>
#include <boost/range/algorithm_ext/iota.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/lambda/lambda.hpp>
using namespace boost::adaptors;
using namespace boost::lambda;
You can’t perform that action at this time.