Skip to content

Instantly share code, notes, and snippets.

@auselen
auselen / instructions.txt
Last active November 15, 2023 13:29
Trying to create a grammar for ARM Unified Assembler Language as specified in ARM Architecture Reference Manual, this is list of all instructions assembler syntaxes.
ADC{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
ADC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
ADC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
ADD{<c>}{<q>} <Rd>, PC, #<const>
ADD{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
ADD{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
ADD{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
ADD{S}{<c>}{<q>} {<Rd>,} SP, #<const>
ADD{S}{<c>}{<q>} {<Rd>,} SP, <Rm>{, <shift>}
ADDW{<c>}{<q>} {<Rd>,} <Rn>, #<const>
@auselen
auselen / ♡.md
Last active August 28, 2023 21:43
Drawing a heart with AWK

Drawing a heart with AWK

Heart

Math

  • t = 0 → 2𝜋
  • x = 16 sin³(t)
  • y = 13 cos(t) - 5 cos(2 t) - 2 cos(3 t) - cos(4 t)

Code

@auselen
auselen / blocket.py
Last active August 17, 2021 11:31
scrap from blocket.se
from requests import get
from lxml import html
from operator import itemgetter
citycodes = {'skane' : '23', 'lund': '23_10', 'eslov' : '23_2'}
result = []
def list(city, keyword, limit):
url = 'http://www.blocket.se/' + city + '?q=' + keyword + \
'&cg=0&w=0&st=s&ca=' + citycodes[city] + '&is=1&l=0&md=th'
set -g mouse on
set-option -g history-limit 50000
set-window-option -g xterm-keys on
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
@auselen
auselen / canlitvlive.sh
Created September 1, 2015 00:51
canlitvlive to kodi
#!/bin/sh
link=`curl -s "http://www.canlitvlive.org/izle/$1.html" |sed -n 's/.*file:"\(.*\)"}]}]\(.*\)/\1/p'`
livestreamer --player-external-http --player-external-http-port 8087 "hls://$link" worst
@auselen
auselen / closure.go
Created May 22, 2017 10:04
Go - Closure
var hostname = func() func() string {
s, _ := os.Hostname()
return func() string {
return s
}
}()
@auselen
auselen / TLD.md
Created April 13, 2017 07:42
Root Zone Database stats

A simple analysis of http://www.iana.org/domains/root/db

$ curl -s http://www.iana.org/domains/root/db | xmllint --html --xpath "//table/tbody/tr/td[1]/span/a|//table/tbody/tr/td[2]|//table/tbody/tr/td[3]" - 2>/dev/null | tr -d '\n' | sed 's/<a[^>]*>/\n/g' | sed -e 's/<[^>]*>/|/g' | awk -F '|' '{print $5,"|",$3}' | sort | uniq -c | sort -rn | awk '{if ($1>4) print $0}'
     51 Amazon Registry Services, Inc. | generic
     43 Charleston Road Registry Inc. | generic
     22 United TLD Holdco Ltd. | generic
     22 Uniregistry, Corp. | generic
     18 Top Level Domain Holdings Limited | generic
     14 Not assigned | country-code
     14 Afilias plc | generic
@auselen
auselen / π.md
Last active March 24, 2017 15:23

Code

 awk 'BEGIN{srand(); while (++i) {pi += ((rand()**2+rand()**2) <= 1); if ((i%10e5) == 0) printf "%f\n",4*pi/i;}}'

Result

3.140352
3.139892

TR Map

Map

Code

curl -s http://download.maxmind.com/download/worldcities/worldcitiespop.txt.gz \
@auselen
auselen / mandelbrot.md
Last active March 24, 2017 15:17
Drawing Mandelbrot with AWK

Drawing Mandelbrot with AWK

Mandelbrot

Code

$ LC_ALL=ISO-8859-1 awk 'BEGIN { \
 max=256; \