Skip to content

Instantly share code, notes, and snippets.

@gwpl
gwpl / clean.sh
Last active March 31, 2025 13:39
`openssl pkeyutl` how to: -sign -verify -encrypt -decrypt , using openssh keys snippets/examples
rm -v pub.pkcs8 test.sign test.txt.decrypted test.txt.encrypted
@oconnor663
oconnor663 / rw.py
Created September 2, 2015 00:17
reading and writing from an os.pipe() in asyncio
#! /usr/bin/python
import asyncio
import os
@asyncio.coroutine
def do_writing(writer):
for i in range(1, 4):
writer.write(("stuff " + str(i)).encode())
@thinkingfish
thinkingfish / conclusion.md
Last active September 26, 2015 09:35
testing formatted print

#TL;DR For printing integers, using your own method (see print.c) to print out each decimal digits into a fixed buffer uses about 90% less time than using a format print function such as snprintf.

#setup

# print.c is the source code used for testing.
# to compile the source for print method M
# If M is between 1 and 12, it uses a particular format string to print
# Otherwise, the customized unsigned int print function is used to print one integer (result is equivalent to method 6)
METHOD=
@reberhardt7
reberhardt7 / export_issues.py
Created July 17, 2015 20:05
Github Issues Export: This script exports all issues from a repository, along with comments and events, into a JSON file. It also produces a Markdown file that can be used to easily view the issues.
"""
This script uses Github's API V3 with Basic Authentication to export issues from
a repository. The script saves a json file with all of the information from the
API for issues, comments, and events (on the issues), downloads all of the
images attached to issues, and generates a markdown file that can be rendered
into a basic HTML page crudely mimicking Github's issue page. If the gfm module
is available, the script will go ahead and render it itself.
In the end, you'll be left with a folder containing a raw .json file (which you
can use to extract information for your needs, or to import it somewhere else),
@dannguyen
dannguyen / iowa-liquor-sales-dataset.readme.md
Last active October 30, 2024 19:04
Cleaning, summing up the State of Iowa Liquor Sales dataset

Iowa Liquor Sales dataset via Socrata/data.iowa.gov

(preliminary exploration)

The state of Iowa has released an 800MB+ dataset of more than 3 million rows showing weekly liquor sales, broken down by liquor category, vendor, and product name, e.g. STRAIGHT BOURBON WHISKIES, Jim Beam Brands, Maker's Mark

This dataset contains the spirits purchase information of Iowa Class “E” liquor licensees by product and date of purchase from January 1, 2014 to current. The dataset can be used to analyze total spirits sales in Iowa of individual products at the store level.

You can view the dataset via Socrata

  • Grundsituation:
  • Es gibt einen Community-Mesh-Prefix (z.B. /18)
  • Der Prefix ist in Blöcke von z.B. 4 Adressen unterteilt (ein /18 ergibt 4096 Blöcke a 4 Adressen)
  • Knoten multicasten periodisch Listen ihrer reservierten Blöcke, um Konflikte zu erkennen
  • Jeder Knoten hat irgendeinen Identifier (untere 8 Byte der IPv6-Adresse?)
  • Jeder Knoten unterhält eine Liste der Blöcke mit zuständigen Knoten
  • Situation: Ein Knoten braucht neue Adressen (z.B. auch nach Boot)
    1. Der Knoten wählt zufällig einen der Blöcke aus (gegebenfalls unter Ausschluss schon bekannter von anderen Knoten verwendeter Blöcke)
    1. Der Knoten fragt mehrmals per Multicast im Mesh, ob der Block schon verwendet wird
required types
--------------
- [X] Block allocation/freeing/delegation
- [ ] request for block owner
- [ ] lease renewal (proxy)
- [ ] lease renewal response (proxy)
Allocate Block
@imjasonh
imjasonh / markdown.css
Last active January 3, 2025 20:15
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@passcod
passcod / .gitignore
Last active March 11, 2025 19:39
License stats for crates on crates.io
/metacrate-*