Skip to content

Instantly share code, notes, and snippets.

@ximik777
ximik777 / print_tree.c
Last active October 10, 2024 07:50
Printing Binary Trees in Ascii
/*
Copy from: http://web.archive.org/web/20090617110918/http://www.openasthra.com/c-tidbits/printing-binary-trees-in-ascii/
Source: http://web.archive.org/web/20071224095835/http://www.openasthra.com:80/wp-content/uploads/2007/12/binary_trees1.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@squiidz
squiidz / btree.c
Last active January 31, 2023 15:22
Btree implementation in C
#include "stdio.h"
#include "stdlib.h"
#define M 3
typedef struct _node {
int n; /* n < M No. of keys in node will always less than order of B tree */
int keys[M - 1]; /*array of keys*/
struct _node *p[M]; /* (n+1 pointers will be in use) */
} node;
@arebee
arebee / Search-FileIndex.ps1
Last active September 13, 2024 07:17
Use Windows Search from PowerShell
function Search-FileIndex {
<#
.PARAMETER Path
Absoloute or relative path. Has to be in the Search Index for results to be presented.
.PARAMETER Pattern
File name or pattern to search for. Defaults to no values. Aliased to Filter to ergonomically match Get-ChildItem.
.PARAMETER Text
Free text to search for in the files defined by the pattern.
.PARAMETER Recurse
Add the parameter to perform a recursive search. Default is false.
@schmohlio
schmohlio / sse.go
Last active August 21, 2024 05:00 — forked from ismasan/sse.go
Example SSE server in Golang
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"
@mowings
mowings / client.go
Last active October 11, 2024 01:43
Golang Websocket JSONRPC server and client
package main
import (
"golang.org/x/net/websocket"
"log"
"net/rpc/jsonrpc"
)
// In a real project, these would be defined in a common file
type Args struct {
@nadeemsyed
nadeemsyed / gist:c89d67fe5805788b7243
Created July 20, 2015 19:21
Create a sample shared library in golang 1.5.
nadeem@myznc:~/go/src$ ls -al dummy
total 12
drwxrwxr-x 2 nadeem nadeem 4096 Jul 20 18:46 .
drwxrwxr-x 6 nadeem nadeem 4096 Jul 20 18:45 ..
-rw-rw-r-- 1 nadeem nadeem 129 Jul 20 18:46 hello.go
nadeem@myznc:~/go/src/dummy$ cat hello.go
// Package dummy contains hello world library.
package dummy
@denji
denji / golang-tls.md
Last active May 14, 2025 16:19 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@skeeto
skeeto / Makefile
Created October 21, 2014 03:51
C Object Oriented Programming Example
CFLAGS = -std=c99 -Wall
main : main.o
.PHONY : test clean
test : main
./$^ "*regex*" "*vtable*" < main.c
clean :
/*
* Btree example for DynnOS
*
* Quenza simple license
* 2013, Dinux
*
*
*/
@inclooder
inclooder / vim_format_in_dir
Created August 26, 2014 07:57
Format all files in directory using vim
:args ~/src/myproject/**/*.cpp | argdo execute "normal gg=G" | update