Skip to content

Instantly share code, notes, and snippets.

View msehnout's full-sized avatar
💭
🇨🇿

msehnout

💭
🇨🇿
View GitHub Profile
use std::env;
use std::io::{self, stdin, Read, Write, Result};
use std::net::{SocketAddrV4, TcpStream, UdpSocket, TcpListener, Ipv4Addr};
use std::str;
use std::sync::Arc;
use std::thread;
static MAN_PAGE: &'static str = /* @MANSTART{tail} */ r#"
NAME
nc - Concatenate and redirect sockets
@msehnout
msehnout / main.rs
Last active November 2, 2017 13:45
C++17 Coding Challenge in Rust
/*
* # C++17 Coding challenge in Rust
* How to deal with edge cases:
* * if the input file is empty, the program should write “input file missing” to the console.
* * if the input file does not contain the specified column, the program should write “column name doesn’t exists in the input file” to the console.
*
* The rest was not considered and mercilessly unwrapped.
*/
use std::env;
@msehnout
msehnout / main.rs
Created March 2, 2018 13:05
Simple flat_map example - filtering data from list of structs
#[derive(Debug)]
struct Task {
b: u8,
c: String,
}
#[derive(Debug)]
struct Day {
a: u8,
@msehnout
msehnout / azure_image.json
Last active December 10, 2019 19:06
[WIP] osbuild pipeline for the new Azure image
{
"build": {
"pipeline": {
"stages": [
{
"name": "org.osbuild.dnf",
"options": {
"repos": [
{
"metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch",
@msehnout
msehnout / print.py
Created December 15, 2019 12:09
Print a list of images into a PDF file with two images per page.
import os
from fpdf import FPDF
from PIL import Image
input = os.environ["INPUT"]
output = os.environ["OUTPUT"]
images = os.listdir(input)
print(images)
@msehnout
msehnout / test.md
Last active December 23, 2019 09:01

Code:

package main

import "fmt"

func main() {
	abc := []string{"aaa", "bbb", "ccc"}
	for i := range abc {
 fmt.Println(i)
import requests
from requests_kerberos import HTTPKerberosAuth
class Response:
def __init__(self, data, id, status):
self.data = data
self.id = id
self.status = status
@msehnout
msehnout / test.py
Last active April 13, 2021 10:43
dnf resolve 2 package sets
#!/usr/bin/python3
import dnf
base = dnf.Base()
conf = base.conf
conf.cachedir = '/tmp/my_cache_dir'
conf.substitutions['releasever'] = '33'
conf.substitutions['basearch'] = 'x86_64'
base.repos.add_new_repo('my-repo', conf,
@msehnout
msehnout / commit.json
Created April 21, 2021 14:12
Initial OSTree commit
{
"version": "2",
"pipelines": [
{
"name": "build",
"runner": "org.osbuild.rhel84",
"stages": [
{
"type": "org.osbuild.rpm",
"inputs": {
@msehnout
msehnout / commit.json
Created April 21, 2021 14:13
OSTree commit with a parent
{
"version": "2",
"pipelines": [
{
"name": "build",
"runner": "org.osbuild.rhel84",
"stages": [
{
"type": "org.osbuild.rpm",
"inputs": {