Skip to content

Instantly share code, notes, and snippets.

Avatar
loading...

Andreas typable

loading...
View GitHub Profile
View snip.sh
#!/bin/bash
if [[ "$1" == "new" ]]; then
if [[ -f ".snip" ]]; then
echo "Not empty dir!"
exit 0
fi
cp -r /d/bin/_snip/* ./
touch .snip
echo "Created a new snip."
View sublimetext-chromeos.md

SublimeText for ChromeOS

Installation

sudo su
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | apt-key add -
apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | tee /etc/apt/sources.list.d/sublime-text.list
apt-get update
View internship.md

Task

2. Network

OSI Reference Model

Layer Function Examples
Application High-level APIs, including resource sharing, remote file access HTTP, WebSocket
Presentation Translation of data between a networking service and an application; including character encoding, data compression and encryption/decryption MIME, SSL, TLS
@typable
typable / terminal-noise.js
Last active Nov 5, 2021
Terminal 2D Noise
View terminal-noise.js
function base(n) {
return Math.pow(2, n) + 1;
}
function find(x, n) {
let b = 2;
let i = 0;
while(x > b) {
b = base(i + 1);
i++;
@typable
typable / linkedlist.go
Last active Apr 28, 2021
LinkedList - Go
View linkedlist.go
package main
type Node struct {
val int
ref *Node
}
type Linkedlist struct {
list *Node
}
@typable
typable / dns.js
Last active Apr 28, 2021
Update Domain IP
View dns.js
import request from './request.js';
const EXTERNAL_IP_SERVICE_URL = 'http://checkip.amazonaws.com';
const DOMAIN_IP_SERVICE_URL = 'https://dns.google.com/resolve';
const DOMAIN_PROVIDER_SERVICE_URL = 'https://dynamicdns.park-your-domain.com';
async function resolve(domain) {
if(typeof domain === 'undefined' || domain.length == 0) {
throw 'Invalid domain argument!';
}
@typable
typable / gamepad.js
Last active Apr 28, 2021
Detect Gamepad input
View gamepad.js
const KEY_BINDING = {
0: 'A',
1: 'B',
2: 'X',
3: 'Y',
4: 'L1',
5: 'R1',
6: 'L2',
7: 'R2',
8: 'Option',
@typable
typable / navigate.js
Last active Apr 28, 2021
Canvas Mouse Dragging
View navigate.js
// state
state = {
origin: { x: 0, y: 0 },
move: { x: 0, y: 0 },
scale: 1,
delta: 0.5,
dragging: false,
min: 1,
max: 100
};
View openstreetmap.md

OpenStreetMap API

A Leaflet JS implementation to provide Map-Views based on OSM (OpenStreetMap).
Leaflet Docs

Leaflet CDN:

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css">
<script type="text/javascript" src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"></script>
@typable
typable / common.js
Last active Apr 28, 2021
JavaScript Cheat Sheet
View common.js
// sigmoid function
(x) => 1 / (1 + Math.pow(Math.E, -k * (x - b)));
// parable function
(x) => a * Math.pow(x - b, 2) + c;
// range function
// returns array with numbers from 0 to n
(n) => [...Array(n).keys()];