Skip to content

Instantly share code, notes, and snippets.

@saward
saward / main.rs
Created May 15, 2022 15:00
Async Rust based on Tower blog example
use async_std::io::prelude::*;
use async_std::io::Error;
use async_std::net::{TcpListener, TcpStream};
use async_std::prelude::Future;
use async_std::task;
use std::time::Duration;
struct Server {
addr: String,
}
@saward
saward / godot_recursive_move.gd
Last active July 15, 2022 05:46
Example of Godot path movement using recursion
# MIT licenced. Feel free to use in your project.
# Use recursion to move along path. We move along path, and if there's any
# distance remaining, we call this function again and move further along until
# we reach our destination or there's no distance left to travel
func move_along_path(distance : float) -> void:
# Ensure we have an actual path, otherwise we are done and can stop
# processing
if path.size() == 0:
set_process(false)
return
@saward
saward / bumpme
Created April 23, 2019 05:19
bumpme
0
{
"user": {
"id":"user_id_1",
"username":"user1",
"email":"user1@example.com",
"Password":"JDJhJDEyJDVTU3Zvb2NGaFZpSlBScENKcVVlNXVlTGk1TExKdFZFQmtLMUozQ0xZUWl2cFkyL2g1RGN1",
"PasswordSalt":"MQ=="
},
"repositories": [
{
package main
import (
"github.com/influxdb/influxdb/client/v2"
"time"
)
const (
MyDB = "square_holes"
username = "bubba"
@saward
saward / iso_test.go
Last active August 29, 2015 14:02
Serializable vs repeatable read
package iso
import (
"database/sql"
"errors"
"fmt"
_ "github.com/lib/pq"
"runtime"
"strings"
"testing"
@saward
saward / Crafting.qml
Last active August 29, 2015 13:58
Null vs undefined
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0
// import GoExtensions 1.0
CitWindow {
id: craftingWindow
width: 700
height: 350
2014/03/28 13:06:16 Inventory.qml:64: file:///C:/gopath/src/bitbucket.org/saward/game/dialogs/Inventory.qml:64: ReferenceError: invModel is not defined
2014/03/28 13:06:16 Crafting.qml:57: file:///C:/gopath/src/bitbucket.org/saward/game/dialogs/Crafting.qml:57: ReferenceError: buildModel is not defined
2014/03/28 13:06:16 qwindowsglcontext.cpp:1112: getProcAddress: Unable to resolve 'glGenFramebuffers'
2014/03/28 13:06:16 qwindowsglcontext.cpp:1112: getProcAddress: Unable to resolve 'glGenFramebuffersOES'
2014/03/28 13:06:16 qwindowsglcontext.cpp:1112: getProcAddress: Unable to resolve 'glGenFramebuffersARB'
2014/03/28 13:06:16 qwindowsglcontext.cpp:1112: getProcAddress: Unable to resolve 'glBindFramebuffer'
2014/03/28 13:06:16 qwindowsglcontext.cpp:1112: getProcAddress: Unable to resolve 'glBindFramebufferOES'
2014/03/28 13:06:16 qwindowsglcontext.cpp:1112: getProcAddress: Unable to resolve 'glBindFramebufferARB'
Changing address from to 192.168.0.148:2222
2014/03/28 13:06:18 Connect.qml:35: Address: 192.1
@saward
saward / delegate.go
Last active August 29, 2015 13:57
Error with uint32
package main
import (
"fmt"
"github.com/niemeyer/qml"
"image/color"
"math/rand"
"os"
"time"
)
@saward
saward / gist:5866928
Created June 26, 2013 12:14
go crypt test
package main
import (
"crypto/md5"
"hash"
"fmt"
"io"
)
const loops = 5000000