Skip to content

Instantly share code, notes, and snippets.

View sebastianbachmann's full-sized avatar
💤

Sebastian Bachmann sebastianbachmann

💤
View GitHub Profile
@levelsio
levelsio / gist:5bc87fd1b1ffbf4a705047bebd9b4790
Last active April 26, 2024 19:34
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@levelsio
levelsio / git_graph.php
Last active June 5, 2023 03:49
GitHub style graph in PHP + CSS
<style>
.git-graph {
text-align: left;
line-height: 1;
}
.git-graph-row {
clear: both;
text-align: left;
}
.git-graph-cell {
#!/usr/bin/env ruby
#
# Recreate Lightroom catalog by replacing corrupt files with recovered copies
#
# Keeps the directory structure and creates the new catalog in a new path,
# which means you'll need at least 3x the size of your photos of free space.
#
# Dependencies:
# - ruby
# - exiftool
#!/usr/bin/env bash
# Instructions:
# 1. Create a webhook here https://getmakerlog.com/apps/webhooks
# 2. Add generated key into this file
# 3. Write contents to .git/hooks/post-commit in the repos you want to track
WEBHOOK_URL="https://api.getmakerlog.com/apps/webhook/<your web hook key>"
MESSAGE=`git log -1 --pretty=%B`
curl --silent --output /dev/null -d "{\"done\":\"true\", \"content\":\"Commited: $MESSAGE\"}" -H "Content-Type: application/json" -X POST $WEBHOOK_URL
@marckohlbrugge
marckohlbrugge / wip_graphql_demo.rb
Last active October 10, 2022 11:46
Ruby example of creating a todo and then completing it using wip.co graphql.
# NOTE: Be sure to set the API key further down in the code!
require "net/http"
require "uri"
require "json"
class WIP
def initialize(api_key:)
@api_key = api_key
end
@cmoulton
cmoulton / UISwiftRestDemo
Last active September 9, 2021 21:01
Quick & dirty REST API calls with Swift 2.2. See http://grokswift.com/simple-rest-with-swift/
// MARK: Using NSURLSession
// Get first todo item
let todoEndpoint: String = "http://jsonplaceholder.typicode.com/todos/1"
guard let url = NSURL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = NSURLRequest(URL: url)
@mpasternacki
mpasternacki / freebsd_on_mbp.md
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

@nyg
nyg / iOSCreatePDF.swift
Last active April 2, 2024 11:09
iOS, Swift: Create a PDF file from an HTML string.
// Thanks to http://www.labs.saachitech.com/2012/10/23/pdf-generation-using-uiprintpagerenderer
// Note: including images in the HTML won't work, see here:
// https://github.com/nyg/HTMLWithImagesToPDF
import UIKit
// 1. Create a print formatter
let html = "<b>Hello <i>World!</i></b>"
let fmt = UIMarkupTextPrintFormatter(markupText: html)
@armstrongnate
armstrongnate / basic-auth.swift
Created July 20, 2014 21:45
HTTP Basic Authentication using NSURLSession in swift
import Foundation
let config = NSURLSessionConfiguration.defaultSessionConfiguration()
let userPasswordString = "username@gmail.com:password"
let userPasswordData = userPasswordString.dataUsingEncoding(NSUTF8StringEncoding)
let base64EncodedCredential = userPasswordData!.base64EncodedStringWithOptions(nil)
let authString = "Basic \(base64EncodedCredential)"
config.HTTPAdditionalHeaders = ["Authorization" : authString]
let session = NSURLSession(configuration: config)
@whitingx
whitingx / meta-tags.md
Created October 5, 2012 16:41 — forked from kevinSuttle/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>