Skip to content

Instantly share code, notes, and snippets.

@Tusenka
Tusenka / gkos_char_device.c
Created September 20, 2023 07:47 — forked from dhilst/gkos_char_device.c
Device Driver Hello World
/*
* file: gkos_char_device.c
*
* Desc: A simple device that
* echos a message when read,
* write method not implemented
*
* This was made on top of
* LDD and LKMPG examples
*
@Tusenka
Tusenka / walk.go
Created October 11, 2024 13:51
Exercise: Equivalent Binary Trees
https://go.dev/tour/concurrency/8
package main
import "golang.org/x/tour/tree"
import "fmt"
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int){
_walk(t,ch)
@Tusenka
Tusenka / web_crawler.go
Created October 11, 2024 15:40
Web Crawler
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
import pandas as pd
import matplotlib.pyplot as plt
def to_range(y):
return to_strings(list(range(y.count())))
def to_strings(y):
return list(map(str, y))
@Tusenka
Tusenka / countries.sql
Created October 13, 2024 16:40
countries_recursive.sql
WITH RECURSIVE e AS (SELECT
id, CAST(name AS TEXT), parent_id, 1 AS level
FROM
geo
WHERE geo.id=4
UNION
SELECT geo.id, e.name||'->'|| geo.name as name, geo.parent_id, e.level+1 as level
FROM geo
INNER JOIN e ON geo.parent_id=e.id
)
@Tusenka
Tusenka / good explanation
Created October 14, 2024 05:31
good explanation
https://math.stackexchange.com/questions/2353141/what-is-the-possible-number-of-commutative-binary-operations-that-can-be-defined
@Tusenka
Tusenka / simple_graph.py
Created October 15, 2024 05:44
simple_graph
import pandas as pd
import matplotlib.pyplot as plt
MIN_DATA_LENGTH=3;
def to_range(y):
return to_strings(list(range(y.count())))
def to_strings(y):
@Tusenka
Tusenka / gist:b5c7fe51fb37dd47229f733395d05bfe
Created October 15, 2024 05:50
search and replace world under cursor
https://vim.fandom.com/wiki/Search_and_replace#substitute_last_search
https://www.postgresql.org/docs/current/manage-ag-tablespaces.html
CREATE TABLE post_partitioned (
pk int GENERATED ALWAYS AS IDENTITY,
title TEXT,
content TEXT,
author INTEGER,
category INTEGER,
reply_to INTEGER,
created_on TIMESTAMP WITH TIME ZONE,
last_edited_on TIMESTAMP WITH TIME ZONE,
editable BOOLEAN,