Skip to content

Instantly share code, notes, and snippets.

View TyrfingMjolnir's full-sized avatar
💭
in my scriptorium whipping up some whoopass

Tyrfing Mjølner TyrfingMjolnir

💭
in my scriptorium whipping up some whoopass
View GitHub Profile
@TyrfingMjolnir
TyrfingMjolnir / Display.swift
Created April 18, 2020 20:26 — forked from hfossli/Display.swift
Display mode
import UIKit
public enum DisplayType {
case unknown
case iphone4
case iphone5
case iphone6
case iphone6plus
static let iphone7 = iphone6
static let iphone7plus = iphone6plus
@TyrfingMjolnir
TyrfingMjolnir / README.md
Created January 21, 2020 19:14 — forked from cneira/README.md
bhyve on SmartOS

Introduction

The following options that aren't in the kvm brand should work:

  • com1, com2
    • Can be set to tty-like devices or socket,/some/path.
    • If both are unset, com1 defaults to /dev/zconsole and com2 defaults to /tmp/vm.ttyb.
  • bootrom
    • Should be set to /usr/share/bhyve/BHYVE_UEFI.fd or /usr/share/bhyve/BHYVE_UEFI_CSM.fd
  • Defaults to /usr/share/bhyve/BHYVE_UEFI_CSM.fd
@TyrfingMjolnir
TyrfingMjolnir / curl.md
Created January 5, 2020 03:51 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@TyrfingMjolnir
TyrfingMjolnir / init.sql
Created November 1, 2019 19:08 — forked from zaydek-old/init.sql
What I’ve learned so far using GraphQL + Postgres.
-- Postgres:
create extension pgcrypto;
create function gen_random_int(max int, out rand int) as $$
select floor(random() * max)::int + 1;
$$ language sql;
create function url62(out id text) as $$
declare
base text :=
@TyrfingMjolnir
TyrfingMjolnir / SSHKeys.sh
Created October 2, 2019 06:46 — forked from nrollr/SSHKeys.sh
Generate SSH keys
#!/bin/bash/
ls -al ~/.ssh # Lists existing files in your .ssh directory
ssh-keygen -t rsa -b 4096 -C "your_email@domain.com" # Creates new ssh key, using the provided email as label
eval "$(ssh-agent -s)" # Ensure ssh-agent is enabled
ssh-add ~/.ssh/id_rsa # Add ssh key to the ssh-agent
@TyrfingMjolnir
TyrfingMjolnir / nginx.conf
Last active March 6, 2021 17:50 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@TyrfingMjolnir
TyrfingMjolnir / foundation.md
Created May 1, 2019 10:09 — forked from ianpartridge/foundation.md
The effect of linking Foundation on Linux

Without Foundation:

# swift package init --type executable && swift run
Creating executable package: bare
Creating Package.swift
Creating README.md
Creating .gitignore
Creating Sources/
Creating Sources/bare/main.swift
{
"brand": "bhyve",
"resolvers": [
"208.67.222.222",
"208.67.220.220"
],
"bootrom": "uefi",
"ram": 4096,
"vnc_port": 15910,
"nics": [
kdebug_signpost_start(10, 0, 0, 0, 0)
// your test code
kdebug_signpost_end(10, 0, 0, 0, 0)
let urlSession = URLSession.shared
let dlTask: URLSessionDownloadTask = urlSession.downloadTask(with: url)
kdebug_signpost_start(20, (uintptr_t)dlTask, 0, 0, 0)
// your test code
kdebug_signpost_end(20, (uintptr_t)dlTask, 0, 0, 0)
@TyrfingMjolnir
TyrfingMjolnir / RawHTTP.swift
Last active September 15, 2023 01:32 — forked from kaqu/RawHTTP.swift
Swift HTTP over Network framework
import Network
let host: NWEndpoint.Host = .init( "httpbin.org" )
let port: NWEndpoint.Port = .https
let tlsConfig: NWProtocolTLS.Options = .init()
let parameters: NWParameters = .init( tls: tlsConfig )
let connection: NWConnection = .init( host: host, port: port, using: parameters )
connection.stateUpdateHandler = { state in
print( "State Update: \( state )" )
}