Skip to content

Instantly share code, notes, and snippets.

View literadix's full-sized avatar
💭
I may be slow to respond.

literadix

💭
I may be slow to respond.
View GitHub Profile
@literadix
literadix / golang_write_to_gzip_file.go
Created July 9, 2019 10:49
golang write to gzip file
/*
This is an example of a golang gzip writer program,
which appends data to a file.
*/
package main
@rust-play
rust-play / playground.rs
Created May 22, 2018 08:53
Code shared from the Rust Playground
extern crate num;
use num::bigint::BigInt;
fn main() {
match "123123123123123123123".parse::<BigInt>() {
Ok(n) => println!("{}", n),
Err(_) => println!("Error")
}
@kylemanna
kylemanna / README-python-service-on-systemd-activated-socket.md
Last active May 12, 2024 12:27 — forked from drmalex07/README-python-service-on-systemd-activated-socket.md
An example network service with systemd-activated socket in Python. #systemd #python #socket #socket-activation

README

The example below creates a TCP server listening on a stream (i.e. SOCK_STREAM) socket. A similar approach can be followed to create a UDP server on a datagram (i.e. SOCK_DGRAM) socket. See man systemd.socket for details.

An example server

Create an simple echo server at ~/tmp/foo/serve.py.

ic[x_, y_] := 1 E^(-350 ((x - 1/5)^2 + ( y - 1/3)^2))
solnDir =
NDSolve[
{D[u[x, y, t], {t, 2}] == D[u[x, y, t], {x, 2}] + D[u[x, y, t], {y, 2}],
u[x, y, 0] == ic[x, y],
(D[u[x, y, t], t] /. t -> 0) == 0,
u[0, y, t] == ic[0, y],
u[1, y, t] == ic[1, y],
u[x, 0, t] == ic[x, 0],
@flakas
flakas / hc-sr04.ino
Created August 8, 2012 12:41
Modified Arduino Ping))) example to work with 4-Pin HC-SR04 Ultrasonic Sensor Distance Measuring Module
/* HC-SR04 Sensor
https://www.dealextreme.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696
This sketch reads a HC-SR04 ultrasonic rangefinder and returns the
distance to the closest object in range. To do this, it sends a pulse
to the sensor to initiate a reading, then listens for a pulse
to return. The length of the returning pulse is proportional to
the distance of the object from the sensor.
The circuit: