Skip to content

Instantly share code, notes, and snippets.

@alixaxel
alixaxel / README.md
Last active June 15, 2023 15:33 — forked from Techwolf12/README.md
Generating IPv6 PTR records from a Bind9 zonefile using Bash

Generating IPv6 PTR records from a Bind9 Zonefile using Bash.

The following script takes a Bind9 zonefile, gets all AAAA records from it and generated PTR records based on them.

What you need to do:

  1. Edit the Zone header in the script.
  2. Run the script with ./generate_v6_ptr.sh /path/to/zonefile.zone

This will output the zones on STDOUT. If you want to save this to a zonefile, you can use this example:

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@alixaxel
alixaxel / smoothing.go
Created February 26, 2017 00:56 — forked from xeoncross/smoothing.go
Peak detection "Smoothed z-score algo" (in Golang) from http://stackoverflow.com/a/22640362/99923
/*
Settings (the ones below are examples: choose what is best for your data)
set lag to 5; # lag 5 for the smoothing functions
set threshold to 3.5; # 3.5 standard deviations for signal
set influence to 0.5; # between 0 and 1, where 1 is normal influence, 0.5 is half
*/
// ZScore on 16bit WAV samples
func ZScore(samples []int16, lag int, threshold float64, influence float64) (signals []int16) {
//lag := 20
@alixaxel
alixaxel / limitedminheap.php
Created May 14, 2016 10:43 — forked from Plutor/limitedminheap.php
A min-max heap and a limited-size min heap (in PHP)
<?php
include 'minmaxheap.php';
/* A min-heap that will restrict itself to a maximum of some number of values.
* Implemented internally as a min-max heap.
*
* Public API:
* - Contructor takes a number, used as the maximum number of values allowed on the heap
* - count() - returns the number of elements on the heap

SHell Time Savers

Note: spaces and casing matter, always!

Unless otherwise stated, all commands are executed against a GNU/Linux OS.

History

Re-run the last command

@alixaxel
alixaxel / README.md
Created February 14, 2016 12:04 — forked from gajus/README.md

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

@alixaxel
alixaxel / Makefile
Created February 10, 2016 16:29
Golang Makefile
.PHONY: build doc fmt lint run test vendor_clean vendor_get vendor_update vet
# Prepend our _vendor directory to the system GOPATH
# so that import path resolution will prioritize
# our third party snapshots.
GOPATH := ${PWD}/_vendor:${GOPATH}
export GOPATH
default: build
@alixaxel
alixaxel / pagination.md
Created February 2, 2016 11:13 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@alixaxel
alixaxel / flatMap.php
Created January 23, 2016 16:16 — forked from italolelis/flatMap.php
FlatMap implementation in PHP, following the Reactive Extensions intiative
function flatMap($data, \Closure $p)
{
$collection = call_user_func_array("array_map", array($p));
return iterator_to_array(new \RecursiveIteratorIterator(
new \RecursiveArrayIterator($data)), false);
}
BM25.Tokenize = function(text) {
text = text
.toLowerCase()
.replace(/\W/g, ' ')
.replace(/\s+/g, ' ')
.trim()
.split(' ')
.map(function(a) { return stemmer(a); });
// Filter out stopStems