Skip to content

Instantly share code, notes, and snippets.

@shortsightedsid
shortsightedsid / cl-tcpip.lisp
Last active December 24, 2025 07:56
Short guide to TCP/IP Client/Server programming in Common Lisp using usockets
; Short guide to TCP/IP Client/Server programming in Common Lisp using usockets
;
; The main reason for this guide is because there are very few examples that
; explain how to get started with socket programming with Common Lisp that I
; could understand. After spending a day trying, I finally came up with a small
; bit of code that makes it easy to understand the basics. I've written this
; primarily for myself, but should help others get started as well.
; As usual, we will use quicklisp to load usocket.
// Option 1: require inline
var app = express();
app.get('/', require('routes/index'));
app.get('/login', require('routes/login').index);
app.post('/login', require('routes/login').do_login);
// Easy to split up routes
// Centralized route paths
@tom-galvin
tom-galvin / vector2.c
Created August 15, 2014 20:57
C vector2 code
/* Quackmatic 2014
* https://github.com/Quackmatic
*/
#include <math.h>
#include "vector2.h"
vec2 vec_add(vec2 v1, vec2 v2)
{
vec2 value = { v1.x + v2.x, v1.y + v2.y };
@francoishill
francoishill / loop_files_folders_recursively.go
Created August 1, 2014 16:52
Loop through files and folders recursively in golang
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() ([]string, error) {
searchDir := "c:/path/to/dir"
@basham
basham / css-units-best-practices.md
Last active June 16, 2026 04:30
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"
@shamil
shamil / mount_qcow2.md
Last active June 5, 2026 10:42
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@tsenart
tsenart / gist:5fc18c659814c078378d
Last active February 25, 2026 11:21
HTTP Closures
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@cleure
cleure / easing.py
Last active December 7, 2023 19:31
Simple easing / tweening example in Python
from math import *
"""
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
@filipkral
filipkral / python-cheat-sheet-basic.py
Last active March 13, 2026 04:06
Basic Python Cheat Sheet
#!/usr/bin/env python
"""Basic Python Cheat Sheet by Filip Kral on 2015/02/16"""
"""
Python is a cross-platform, interpreted, object-oriented programming language.
That means you can run it on Linux, Windows, Mac, and other platforms,
you don't need to compile your code to execute it because it is compiled on
the fly, and you can use classes and objects.