Skip to content

Instantly share code, notes, and snippets.

@scriptnull
scriptnull / term_limits.c
Last active August 19, 2018 16:39
Demonstrates error in finding the system configuration of terminal as mentioned in http://man7.org/tlpi/
#include<unistd.h>
#include<stdio.h>
int main() {
long max_input, max_canon;
max_input = sysconf(_SC_MAX_INPUT);
max_canon = sysconf(_SC_MAX_CANON);
printf("max_input: %ld \n", max_input);
@scriptnull
scriptnull / fdopen_multiple_files_n_processes.go
Created February 28, 2018 21:21
Opens same files from multiple processes.
package main
import (
"fmt"
"log"
"os"
"golang.org/x/sys/unix"
)
@scriptnull
scriptnull / fdopen_multiple_files.go
Created February 28, 2018 20:48
Opens multiple files and prints out their file descriptor value
package main
import (
"fmt"
"log"
"os"
"golang.org/x/sys/unix"
)
@scriptnull
scriptnull / fdopen.go
Created February 28, 2018 20:22
Opens a file and prints the file descriptor
package main
import (
"fmt"
"log"
"os"
"golang.org/x/sys/unix"
)
@scriptnull
scriptnull / printvar.rs
Created February 6, 2018 01:50
experimenting strace and rust
fn main() {
let x = 1;
println!("value of x is {}", x);
}
@scriptnull
scriptnull / printvar.cr
Created February 6, 2018 01:39
experimenting strace and crystal
x = 1
puts "value of x is #{x}"
@scriptnull
scriptnull / printvar.py
Created February 6, 2018 01:24
experimenting strace and python
#!/usr/bin/python
x = 1
print "value of x is", x
@scriptnull
scriptnull / printvar.js
Created February 6, 2018 01:15
experimenting strace and node.js
#!/usr/bin/node
var x = 1
console.log("value of x is ", x)
@scriptnull
scriptnull / printvar.go
Created February 6, 2018 01:10
experimenting strace on go
package main
import "fmt"
func main() {
x := 1
fmt.Println("value of x is ", x)
}
// solves https://leetcode.com/problems/remove-linked-list-elements/description/
// runtime is 16ms
/**
* Definition for singly-linked list.
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/