Skip to content

Instantly share code, notes, and snippets.

View zakame's full-sized avatar

Zak B. Elep zakame

View GitHub Profile
@Ovid
Ovid / .perldb
Last active July 5, 2022 15:50
My debugger file
package Ovids::Debugger;
# vim: syntax=perl
=head1 NAME
.perldb - Customize your Perl debugger
=head1 USAGE
@alexellis
alexellis / arm.md
Last active May 28, 2024 14:48
Test swarm connectivity

Regular PC / cloud architecture (64-bit)

See the snippets "guide.md" and "redis.md" below.

Swarm on a Raspberry Pi

If you're wanting to run Docker Swarm on your Raspberry Pi checkout these instructions:

@0racle
0racle / Matplotlib.pm6
Created April 11, 2017 14:28
Matplotlib in Perl6
use Inline::Python;
my $py = Inline::Python.new();
$py.run('import matplotlib.pyplot');
class Matplotlib::Mlab {
method FALLBACK($name, |c) {
$py.call('matplotlib.mlab', $name, |c)
}
}
@coco98
coco98 / kube-registry.yaml
Created May 2, 2017 16:31
Docker registry on minikube
apiVersion: v1
kind: ReplicationController
metadata:
name: kube-registry-v0
namespace: kube-system
labels:
k8s-app: kube-registry
version: v0
spec:
replicas: 1
@truatpasteurdotfr
truatpasteurdotfr / Dockerfile
Created May 9, 2017 20:48
alpine and failed perl Number-Format-1.75 test
FROM alpine:latest
MAINTAINER Tru Huynh <[email protected]>
RUN apk update && apk upgrade
RUN apk add \
perl \
make
RUN \
cpan install Number::Format
@ekaschalk
ekaschalk / esh-custom.el
Created June 24, 2017 04:39
Customizing your emacs shell.
(require 'dash)
(require 's)
(defmacro with-face (STR &rest PROPS)
"Return STR propertized with PROPS."
`(propertize ,STR 'face (list ,@PROPS)))
(defmacro esh-section (NAME ICON FORM &rest PROPS)
"Build eshell section NAME with ICON prepended to evaled FORM with PROPS."
`(setq ,NAME
@aprilmintacpineda
aprilmintacpineda / fun-with-bubble-sort.md
Last active September 7, 2021 07:30
Bubble sort implementations in JS, PHP, PY, and Java with tests and performance measurement.

Fun with JS, PHP, PY, and Java

Lots of developers argue about which programming language should be used to do this and that, in reality, all their answers are hugely affected by self bias, most of the time, programmers would use something in favor of something else because of comfortability, they are simply more comfortable using whatever they chose.

All high-level programming languages are pretty much alike, they were built on top of the same concepts, there's MVC in PHP, Java, JavaScript, Python, .NET, etc., they may differ in syntax, but at their very core, they are alike. Much like humans, we differ in color, height, body size, etc., but at our very core, we're all alike, but they differ in terms of speed, like humans differ in intelligence.

So, I made a bubble sort implementation in Java, JavaScript, PHP, and Python. If you don't know the bubble sort algorithm yet and you want to know, then read the [pseudocode](https://gist.github.com/aprilmintacpineda/7800a989f1f494ee8d

@madumlao
madumlao / pi.py
Created April 21, 2018 02:25
Calculates and prints pi
from __future__ import print_function
def picount(n):
count = 2.0
i = 0
j = 1
for k in range(0,n):
if k % 2 == 0:
i += 2
else:
@peti
peti / README.md
Last active January 29, 2024 00:21
Make NixOS provide version-specific LOCALE_ARCHIVE environment variables

This NixOS code ensures that the system provide version-specific $LOCALE_ARCHIVE environment variables to mitigate the effects of NixOS/nixpkgs#38991.

To deploy it, copy the file into your /etc/nixos folder using a file name like multi-glibc-locale-paths.nix. Then edit your configuration.nix file to contain the attribute:

imports = [ ./multi-glibc-locale-paths.nix ];
@mbbx6spp
mbbx6spp / .00readme.org
Last active May 26, 2024 22:53
A caching and persistent Nix shell with direnv

Cached and Persistent Nix shell with direnv integration

Problem being solved

  • the default direnv Nix integration from projects loads a Nix shell every new terminal or every time shell.nix and/or default.nix changes. On larger projects with a lot of Nix shell dependencies, that can cause the terminal to take more than 6 seconds to load, which significantly degrades the developer experience (DX).
  • when a developer garbage collects in their Nix store, often the Nix shell dependencies are deleted also which causes a slow start the next time the project’s Nix shell is requested, also degrading developer experience (DX).

Solution outline

  • on first Nix shell load, the Nix shell is evaluated fully such that direnv dumps the environment from the spawn Nix shell process