Skip to content

Instantly share code, notes, and snippets.

View julianfbeck's full-sized avatar
🐳
Whale hello there

Julian Beck julianfbeck

🐳
Whale hello there
View GitHub Profile
import Foundation
import UIKit
public enum PlausibleError: Error {
case domainNotSet
case invalidDomain
case eventIsPageview
}
public class Plausible {
@julianfbeck
julianfbeck / renderlunarlander.ipynb
Created January 16, 2021 10:12
RenderLunarLander.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@julianfbeck
julianfbeck / loadPNGorJPEG.go
Created January 7, 2021 17:36
Use first 512 bytes of the file to check if an Image is a Jpeg or PNG. Decode and load into channel
func loadImageChannel(pathPicture string, images chan image.Image, errors chan error) {
file, err := os.Open(pathPicture)
if err != nil {
log.Fatalf("failed to open: %s", err)
}
// Only the first 512 bytes are used to sniff the content type.
buffer := make([]byte, 512)
_, err = file.Read(buffer)
if err != nil {
errors <- err
@julianfbeck
julianfbeck / SwiftDateFormats.swift
Last active January 7, 2021 17:36
All Swift Dateformats and Language Codes
//array with all Date formats
["d.M.yy, h:mm:ss a",
"M/d/y GGGGG, HH:mm:ss",
"y-MM-dd HH.mm.ss",
"d.M.yy H:mm:ss",
"d/M/yy, HH:mm:ss",
"dd/MM/yy h:mm:ss a",
"d-M-yy h:mm:ss a",
"d/M/y, H:mm:ss",
"dd/MM/yy, HH:mm:ss",
@julianfbeck
julianfbeck / ShareViewController.swift
Last active September 12, 2019 08:15
Share data between iOS Extension and App via App Group doesn't work consistently
import UIKit
import Social
import MobileCoreServices
class ShareViewController: SLComposeServiceViewController {
let suiteName = "group.sharesheetTest"
override func isContentValid() -> Bool {
// Do validation of contentText and/or NSExtensionContext attachments here
return true
}
@julianfbeck
julianfbeck / discoverLocalWebservices.sh
Created February 10, 2019 16:03
Scan local Network for hosts with port 80 open and open their ips chrome
#!/bin/bash
NETWORK=$(fing -r 1)
#grepIP
IPDubs=$(echo "$NETWORK" | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}')
#Remove dubs
IP=$(echo "$IPDubs" | sort -u)
#scanports
PORT80OPEN=$(echo "$IP" | xargs nmap -p80 --open | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}')
#openInchrome
while read line; do
@julianfbeck
julianfbeck / Mia_resources.js
Created July 19, 2018 23:40
Convert google sheet html exports to netscape bookmarks. One folder per sheet
const htmlparser = require("htmlparser");
const fs = require("fs")
const cheerio = require('cheerio')
const netscape = require('netscape-bookmarks');
const path = require("path");
let template = {
Mia: {
contents: {}
},
}
#include <stdlib.h>
#include <printf.h>
#define GRN "\x1B[32m"
#define YEL "\x1B[33m"
#define RESET "\x1B[0m"
#include <stdio.h>
#include <string.h>
char *extract(char *input, char *pattern);
void extract2(char *input, char **output,char *pattern);
int findPattern(char *input, char *pattern);