Skip to content

Instantly share code, notes, and snippets.

@chrisrink10
chrisrink10 / config_vlans
Created August 22, 2023 23:51
3 VLAN Configuration for ASUS RT-AX88U with Merlin
#!/bin/sh
# Create VLANs to match the configuration on the FreshTomato router cj-router-3200
#
# Adapted from the following sources:
# - https://virtualize.link/asus-vlans/
# - https://gist.github.com/Jimmy-Z/6120988090b9696c420385e7e42c64c4
# - https://www.snbforums.com/threads/vlans-trunk-interface-tagged-and-untagged-traffic-rt-ax86u-and-rt-ax88u.78411/#post-846773
# - https://www.snbforums.com/threads/rt-86u-vlanctl-ethctl-usage-puzzle.54375/

why doesn't radfft support AVX on PC?

So there's two separate issues here: using instructions added in AVX and using 256-bit wide vectors. The former turns out to be much easier than the latter for our use case.

Problem number 1 was that you positively need to put AVX code in a separate file with different compiler settings (/arch:AVX for VC++, -mavx for GCC/Clang) that make all SSE code emitted also use VEX encoding, and at the time radfft was written there was no way in CDep to set compiler flags for just one file, just for the overall build.

[There's the GCC "target" annotations on individual funcs, which in principle fix this, but I ran into nasty problems with this for several compiler versions, and VC++ has no equivalent, so we're not currently using that and just sticking with different compilation units.]

The other issue is to do with CPU power management.

Raspberry PI (cli):

  $ DST_HOST=nc_machine_addr
  $ SDSIZE=`sudo blockdev --getsize64 /dev/mmcblk0`;sudo pv -tpreb /dev/mmcblk0 -s $SDSIZE | nc $DST_HOST 19000

Netcat machine | "nc_machine_addr" (srv):

@plashchynski
plashchynski / merge_dna_files.rb
Last active December 30, 2022 09:20
Tool to merge 23andme and Ancestory.com raw dna files
#!/usr/bin/ruby
#
# Usage:
# ruby ./merge_dna_files.rb file,file1,file2... > merged_file.txt
#
# Example:
# ruby ./merge_dna_files.rb AncestryDNA.txt genome_John_Doe_v4_Full_20170428065226.txt > merged_raw.txt
#
# Supports 23andMe, AncestryDNA, and Genes for Good 23andMe compatible file formats.
# The result will be in 23andMe file format.

Raspberry PI (cli):

  $ DST_HOST=nc_machine_addr
  $ SDSIZE=`sudo blockdev --getsize64 /dev/mmcblk0`;sudo pv -tpreb /dev/mmcblk0 -s $SDSIZE | nc $DST_HOST 19000

Netcat machine | "nc_machine_addr" (srv):

Debian on ThinkPad W540

This is a short write-up of my experiences with installing Debian on a ThinkPad W540.

All commands should be run as root, unless indicated otherwise.

Table of Contents

Debian Install Notes

@dougalcampbell
dougalcampbell / NeoPixelTest.ino
Created October 31, 2013 03:29
Example of driving an Adafruit NeoPixel Ring with the Digispark Arduino-compatible board
#include <Adafruit_NeoPixel.h>
#define PIN 1
#define STRIPSIZE 16
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
@guifromrio
guifromrio / nodejs-ubuntu-bind-port-80.md
Last active January 10, 2024 22:47
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@probonopd
probonopd / Send infrared commands from the Arduino to the iRobot Roomba
Created March 17, 2013 10:42
Send infrared commands from the Arduino to the iRobot Roomba. Use a transistor to drive the IR LED from pin D3 for maximal range.
#include <IRremote.h>
/*
Send infrared commands from the Arduino to the iRobot Roomba
by probono
2013-03-17 Initial release
@endolith
endolith / gcd_and_lcm.py
Last active June 22, 2022 23:33
GCD and LCM functions in Python for several numbers
# Greatest common divisor of 1 or more numbers.
from functools import reduce
def gcd(*numbers):
"""
Return the greatest common divisor of 1 or more integers
Examples
--------