Skip to content

Instantly share code, notes, and snippets.

View the-shank's full-sized avatar
💭
#rust #llvm

theshank the-shank

💭
#rust #llvm
View GitHub Profile
@rbq
rbq / docker.yaml
Last active March 18, 2025 17:21
Install Docker CE on Ubuntu using Ansible
---
- hosts: all
tasks:
- name: Install prerequisites for Docker repository
apt:
name: ['apt-transport-https', 'ca-certificates', 'curl', 'gnupg2', 'software-properties-common']
update_cache: yes
- name: Add Docker GPG key
apt_key:
#![feature(test)]
extern crate test;
extern crate itertools;
use test::Bencher;
use itertools::Itertools;
fn strings_vec() -> Vec<String> {
vec![String::from("again"); 512]
@Measter
Measter / lib.rs
Last active August 7, 2022 08:25
Rust Perf Benchmark
#![feature(test)]
extern crate test;
#[cfg(test)]
mod tests {
use super::*;
use std::fs::{File};
use std::io::{BufWriter, Write, BufRead, BufReader};
#[bench]
@se35710
se35710 / find-java.ps1
Last active February 5, 2025 19:24
PowerShell script to locate Java on Windows, optionally sets JAVA_HOME and JRE_HOME.
<#
.SYNOPSIS
Locates Java versions and optionally sets JAVA_HOME and JRE_HOME.
.DESCRIPTION
The Find-Java function uses PATH, JAVA_HOME, JRE_HOME and Windows Registry to retrieve installed Java versions.
If run with no options, the first Java found is printed on the console.
.PARAMETER Vendor
Selects Java vendor, currently supports Oracle, OpenJDK and IBM. Defaults to Any.
.PARAMETER Architecture
What processor architecture to match. Valid options are 32, 64, Match and All. Match detects what integer size is used for the PowerShell process, and matches the architecture. If Wow64 is available, 64 bit versions of Java are selected first.
# Basic commands
:Git [args] # does what you'd expect
all of your `~/.gitconfig` aliases are available.
:Git! [args] # same as before, dumping output to a tmp file
Moving inside a repo.
@stevedonovan
stevedonovan / shared.rs
Created April 14, 2017 13:49
An ergonomic way of saying Rc<RefCell>
use std::rc::Rc;
use std::cell::{RefCell,Ref, RefMut};
use std::ops::Deref;
use std::fmt;
#[derive(Clone)]
struct Shared<T> {
v: Rc<RefCell<T>>
}
@itod
itod / split_keyboards.md
Last active April 26, 2025 15:22
Every "split" mechanical keyboard currently being sold that I know of
@josephan
josephan / joseph.exs
Last active September 29, 2021 20:00
Recursive implementation of reduce and reverse in Elixir
defmodule Joseph do
@moduledoc """
This is my module for the challenges from Elixir TV episode 6
"""
@doc """
Reduces a list to a single value from running a function.
Returns an numeric value.

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4