Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar
🐧
Have you built a Linux kernel recently?

Krzysztof Wilczyński kwilczynski

🐧
Have you built a Linux kernel recently?
  • Yokohama, Japan
  • 17:38 (UTC +09:00)
View GitHub Profile
aws-mfa-refresh() {
local token="$1"
local duration='43200'
if [[ "x$token" == 'x' ]]; then
read -p 'Token: ' token
fi
aws-mfa --token "$token" --duration "$duration"
}
@luk6xff
luk6xff / ARMonQEMUforDebianUbuntu.md
Last active March 27, 2025 16:19 — forked from bruce30262/ARMDebianUbuntu.md
Emulating ARM with QEMU on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

If there's no qemu-arm-static in the package list, install qemu-user-static instead

#include <stdio.h>
#include <stdlib.h>
const int H = 40;
const int W = 80;
char map[H][W];
int rnd(int max) {
return rand() % max;
@munificent
munificent / generate.c
Last active January 27, 2025 18:14
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@kwilczynski
kwilczynski / main.go
Last active February 17, 2019 21:03
A simple unsorted Set type for strings in Go (backed by a map).
package main
import (
"fmt"
"strings"
)
type StringSet map[string]struct{}
func (s *StringSet) String() string {
@kwilczynski
kwilczynski / main.go
Last active June 21, 2022 14:01
Check if a TTY is a valid device aka "check if we are run interactively".
func validTTY() bool {
stat, _ := os.Stdout.Stat()
if (stat.Mode() & os.ModeCharDevice) == 0 {
return false
}
return true
}
@kwilczynski
kwilczynski / main.go
Last active July 7, 2023 14:49
Parse time duration as string - either assume seconds or parse string as rich format e.g., 5m 30s, etc.
package main
import (
"fmt"
"strconv"
"time"
)
func parseExpiry(s string) (time.Duration, error) {
var t time.Duration
@veggiemonk
veggiemonk / CKAD.md
Last active December 9, 2024 17:54
CKAD exam preparation
@kwilczynski
kwilczynski / .bash_profile
Created January 30, 2019 16:18
Okta for AWS - local setup and Go wrapper around okta-aws-cli.jar executable.
. "${HOME}/.java_version"
. "${HOME}/.okta_functions"
@kwilczynski
kwilczynski / Caddyfile
Created January 30, 2019 16:10
Nessus Scanner Fact - collect and expose Nessus Scanner status to Ansible.
https://localhost
tls ./server.pem ./server.key {
ca ./ca.pem
clients require
protocols tls1.0 tls1.1
}
root .
log stdout