Skip to content

Instantly share code, notes, and snippets.

View gwpl's full-sized avatar

Grzegorz Wierzowiecki gwpl

  • Europe - usually: Zürich, Warsaw or Berlin
View GitHub Profile
#![allow(dead_code)]
// playground: https://gist.github.com/rust-play/6d697a29901d4b82cc8b184526d4b8f1
fn all_postfixes_sorted(arr: &[&str]) -> Vec<String> {
let mut postfixes: std::collections::HashSet<String> = std::collections::HashSet::new();
for &w in arr {
for start_idx in 0..(w.chars().count()) {
let slice: &str = &w[start_idx..];
let w = String::from(slice);
#![allow(dead_code)]
// https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=bda017580640d3b70ea211bec7e9038b
// Task: sorted postfixes for given list of strings
// Example: bcd -> bcd,cd,d
// Example: abc,bcd,xyz -> abc,bc,bcd,c,cd,d,xyz,yz,z
fn all_postfixes_sorted(arr: &[&str]) -> Vec<String> {
let mut postfixes: std::collections::HashSet<String> = std::collections::HashSet::new();
for &w in arr {
@luisgagocasas
luisgagocasas / docker-compose.yml
Created December 28, 2021 16:43 — forked from stuart-warren/docker-compose.yml
Start chrome with docker-compose (helps with aws greengrass iot core also)
version: "3.8"
services:
chrome:
network_mode: "host"
image: jess/chrome
environment:
DISPLAY: 'unix:0'
volumes:
- /run/dbus/system_bus_socket:/run/dbus/system_bus_socket
@dvdhrm
dvdhrm / hello-world.rs
Created December 5, 2018 10:36
UEFI Hello World in Rust
//
// Example: Hello World!
//
// This is an example UEFI application that prints "Hello World!", then waits for key input before
// it exits. It serves as base example how to write UEFI applications without any helper modules
// other than the UEFI protocol definitions.
//
// The `efi_main` function serves as entry-point. Depending on your target-configuration, this
// entry point might be called differently. If you use the target-configuration shipped with
// r-efi, then `efi_main` is the selected PE/COFF entry point.
@fmarcia
fmarcia / git-change-date.sh
Created November 3, 2016 09:53 — forked from maciej/git-change-date.sh
git: Change the commit and/or author date of git commits.
#!/bin/sh
#
# Change the commit and/or author date of git commits.
#
# change-date [-f] commit-to-change [branch-to-rewrite [commit-date [author-date]]]
#
# If -f is supplied it is passed to "git filter-branch".
#
# If <branch-to-rewrite> is not provided or is empty HEAD will be used.
@ropnop
ropnop / docker_aliases.sh
Created July 18, 2019 02:16
Docker aliases
function dockershell() {
docker run --rm -i -t --entrypoint=/bin/bash "$@"
}
function dockershellsh() {
docker run --rm -i -t --entrypoint=/bin/sh "$@"
}
function dockershellhere() {
dirname=${PWD##*/}
@rust-play
rust-play / playground.rs
Created August 28, 2019 10:55
Code shared from the Rust Playground
use std::time::{ Instant, Duration };
fn benchmark<F: FnOnce()>(f: F) {
let t0 = Instant::now();
f();
let t1 = Instant::now();
let dt = t1 - t0;
println!("{}", dt.as_millis());
}
@gwpl
gwpl / by_G_foaf_example.ttl
Created October 30, 2022 15:51
by G foaf example, showing simple queries progressing step by step with outputs; run using Apache Jena ; based on https://jena.apache.org/tutorials/sparql.html and https://gitlab.com/gwpl/rdf_20q4
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix ex: <http://example.org/stuff/1.0/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#>.
@prefix wot: <http://xmlns.com/wot/0.1/>.
@prefix xml: <http://www.w3.org/XML/1998/namespace>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@georgeredinger
georgeredinger / tunnels
Created July 31, 2012 21:50
raspberrypi reverse ssh tunnel upstart scripts
pi@raspberrypi ~ $ cat /etc/init/ssh_tunnel.conf
#!upstart
author "george"
description "SSH Tunnel"
start on stopped rc
stop on shutdown
@eteplus
eteplus / logseq-enhanced-theme.css
Created November 3, 2021 01:59
logseq enhanced theme
.block-children {
border-left-width: var(--ls-block-bullet-threading-width);
}
.block-content-wrapper {
position: relative;
}
.bullet-container {
height: 14px !important;