Skip to content

Instantly share code, notes, and snippets.

View baxiry's full-sized avatar
🏠
Working from home

baxiry baxiry

🏠
Working from home
View GitHub Profile
@ityonemo
ityonemo / test.md
Last active July 19, 2024 06:53
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

// this is under the user.go file
func (h *Handler) loginUser(c echo.Context) error {
username := c.FormValue("username")
password := c.FormValue("password")
user := h.service.GetByUsername(username)
if user == nil || user.Password != password {
return echo.ErrUnauthorized
}
@iamranchojr
iamranchojr / main.dart
Last active September 29, 2019 13:44
Flutter Login App
import 'package:flutter/material.dart';
void main(){
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@tom-code
tom-code / h2c.go
Last active July 7, 2023 09:33
golang h2c http2 client and server
package main
import (
"fmt"
"net/http"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
"crypto/tls"
"net"
)
@AmirSoleimani
AmirSoleimani / main.go
Last active January 10, 2023 08:18
Pub/Sub Pattern Golang
package main
import (
"patternsample/mq"
"fmt"
"time"
)
func main() {
@vurtun
vurtun / _readme_quarks.md
Last active December 9, 2023 12:03
Quarks: Graphical user interface

gui

@fatih
fatih / caption-transform.go
Created November 16, 2017 19:06
Wordpress captions to Hugo shortcodes. This is a terrible hack, not performant. Only here for reference
package main
import (
"fmt"
"io/ioutil"
"log"
"net/url"
"os"
"path/filepath"
"regexp"
@asukakenji
asukakenji / go-stdlib-interface-selected.md
Last active July 17, 2024 19:34
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@evalphobia
evalphobia / README.md
Last active February 22, 2024 18:28
Golang Benchmark: gob vs json

tl;dr

  • JSON is faster for small size data
    • map (key size < 50 and Unmarshalling intensive workload)
    • single struct
  • gob is faster for big size data
    • map (key size > 50 or Marshalling intensive workload)
    • slice

(old) about

@corny
corny / lua-udp.lua
Created July 4, 2016 16:08
Lua UDP example
#!/usr/bin/env lua5.2
--
-- apt install lua5.2 lua-socket
--
local socket = require("socket")
local udp = assert(socket.udp())
local data
udp:settimeout(1)