Skip to content

Instantly share code, notes, and snippets.

💭
git push -f

Sergey Bronnikov ligurio

💭
git push -f
Block or report user

Report or block ligurio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active Jan 9, 2020
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
View gist:674ea13c77fc8128f24b5e3f53b7f094
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@DavidBuchanan314
DavidBuchanan314 / cursed_mandelbrot.c
Last active Feb 13, 2020
Compile-time mandelbrot in pure C. Outputs a PGM image file to stdout. Output can be seen at https://twitter.com/David3141593/status/1062468528115200001
View cursed_mandelbrot.c
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
View openbsd_src.cloc
---------------------------------------------------------------------------------------
Language files blank comment code
---------------------------------------------------------------------------------------
C 16045 1151514 1394479 6409501
C++ 9027 380730 428645 2129520
C/C++ Header 12480 401032 766593 2026578
Perl 4122 157859 208622 982209
HTML 903 33457 6243 471775
Bourne Shell 1298 62248 76580 469701
Markdown 259 46737 0 402916
@PurpleBooth
PurpleBooth / Dockerfile
Last active Feb 19, 2020
Create a static binary in go and put it in a from scratch docker container
View Dockerfile
FROM golang:1.9
WORKDIR /go/src/github.com/purplebooth/example
COPY . .
RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go
FROM scratch
COPY --from=0 /go/src/github.com/purplebooth/example/main /main
CMD ["/main"]
@amosr
amosr / House.v
Last active Sep 11, 2019
Coq text adventure
View House.v
Set Implicit Arguments.
Inductive Place
:= Kitchen | Bedroom | Hallway | Outside.
Inductive Card := NORTH | EAST | SOUTH | WEST.
Definition moveTo (p : Place) (c : Card) : option Place :=
match p, c with
@antirez
antirez / lmdb.tcl
Created Apr 28, 2017
LMDB -- First version of Redis written in Tcl
View lmdb.tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@reyk
reyk / vmctl start ubuntu -d ubuntu-16.10-server-cloudimg-amd64.raw -n nat -c
Last active Dec 18, 2018
OpenBSD vmm and meta-data running ubuntu-16.10-server-cloudimg-amd64.raw
View vmctl start ubuntu -d ubuntu-16.10-server-cloudimg-amd64.raw -n nat -c
- Get OpenBSD from http://www.openbsd.org/ ;)
- Find an Ubuntu cloud image on https://cloud-images.ubuntu.com/
- Get https://github.com/reyk/meta-data and configure it for cloud-init
- Run the VM ...
Script started on Thu Mar 30 01:53:50 2017
# qemu-img convert ubuntu-16.10-server-cloudimg-amd64.img ubuntu-16.10-server-cloudimg-amd64.raw
# vmctl start ubuntu -d ubuntu-16.10-server-cloudimg-amd64.raw -n nat -c
Connected to /dev/ttyp6 (speed 9600)
Changing serial settings was 0/0 now 3/0
@torbiak
torbiak / groff-install-font
Created Jan 13, 2017
Install ttf and otf fonts for use with groff
View groff-install-font
#!/usr/bin/env bash
# groff-install-ttf converts a TrueType (ttf) or OpenType (otf) font to a
# Printer Font ASCII (pfa) font and a groff font (ditroff) and installs them to
# groff's site-font directory.
#
# Requires fontforge.
#
# You're the best, Peter Schaffter, but contrary to the verbose and
# difficult-to-follow http://www.schaffter.ca/mom/momdoc/appendices.html#fonts,
# the t42 file doesn't seem to be necessary, at least with recent versions of
View get_dns_blacklists.sh
#!/bin/sh
# "include: /var/unbound/etc/ad-blacklist.conf" in /var/unbound/etc/unbound.conf
# run script as daily cron
TMPFILE=$( mktemp get_dns_blacklists-XXXXXXXXX )
trap 'rm -f $TMPFILE; exit 1' EXIT KILL INT QUIT TERM
(
ftp -VM -o- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | grep ^0.0.0.0 | awk '{ print $2 }'
You can’t perform that action at this time.