Skip to content

Instantly share code, notes, and snippets.

View skaarlcooper's full-sized avatar
🐣

Vinh Cao skaarlcooper

🐣
View GitHub Profile
@skaarlcooper
skaarlcooper / folder_structure.md
Created October 14, 2024 13:14 — forked from ayoubzulfiqar/folder_structure.md
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@skaarlcooper
skaarlcooper / multiwriter.go
Created October 10, 2024 08:44 — forked from brydavis/multiwriter.go
io.TeeReader versus io.MultiWriter
package main
import (
"bytes"
"crypto/md5"
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"os"
@skaarlcooper
skaarlcooper / ABOUT.md
Created October 10, 2024 08:34 — forked from laobubu/ABOUT.md
A very simple HTTP server in C, for Unix, using fork()

Pico HTTP Server in C

This is a very simple HTTP server for Unix, using fork(). It's very easy to use

How to use

  1. include header httpd.h
  2. write your route method, handling requests.
  3. call serve_forever("12913") to start serving on port 12913
@skaarlcooper
skaarlcooper / Laravel on Linux.md
Created September 12, 2024 01:34 — forked from noynaert/Laravel on Linux.md
Installing Laravel on Linux.

Installing Laravel on Linux

Note: This document is not finished.

Written for Laravel 2.3 and PHP 7

This is written for Ubuntu, LinuxMint, and oter debian derivatives that use apt or apt-get. I have tested it on Ubuntu 16.04 LTS. Also, this installation may not be the minimum. In particular, some of the php files May not be absolutely necessary, especially if you are not running nginx and valet.

I have this guide on Fedora using "dnf" instead of apt should work in most places. A few of the PHP bundles are a bit differentently, but It still worked. The Fedora packages seem to be more inclusive, so all of the important PHP components seemed to be loaded.

Homestead

Homestead is a useful tool. but it can be overwhelming at first if you are trying to learn both Laravel and Homestead.

@skaarlcooper
skaarlcooper / git_and_github_instructions.md
Created August 29, 2024 13:21 — forked from mindplace/git_and_github_instructions.md
Pushing your first project to github

1. Make sure git is tracking your project locally

Do you need a refresher on git? Go through Codecademy's git course.

  1. Using your terminal/command line, get inside the folder where your project files are kept: cd /path/to/my/codebase. → You cannot do this simply by opening the folder normally, you must do this with the command line/terminal.
    → Do you need a refresher on using your command line/terminal? I've compiled my favorite resources here.

  2. Check if git is already initialized: git status

diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 621c4e1..a21e0ca 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -61,40 +61,9 @@ typedef struct {
} ps_files;
ps_module ps_mod_files = {
- PS_MOD(files)
+ PS_MOD_SID(files)
@skaarlcooper
skaarlcooper / caching_wrapper.js
Created May 13, 2024 16:25 — forked from bonza-labs/caching_wrapper.js
Javascript cache wrapping
var $w = function(string) { return string.split(' '); };
var asInts = function(arr) {
var results=[];
for(var i=0, m=arr.length; i<m; i++) results.push(parseInt(arr[i], 10));
return results;
};
Array.prototype.map = function(func) {
@skaarlcooper
skaarlcooper / repl-client.js
Created May 7, 2024 14:27 — forked from TooTallNate/repl-client.js
Running a "full-featured" REPL using a net.Server and net.Socket
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)
@skaarlcooper
skaarlcooper / bbs.js
Created May 7, 2024 14:26 — forked from TooTallNate/bbs.js
Running a node.js REPL over `curl`
/**
* Requires node v0.7.7 or greater.
*
* To connect: $ curl -sSNT. localhost:8000
*/
var http = require('http')
, repl = require('repl')
, buf0 = new Buffer([0])