Skip to content

Instantly share code, notes, and snippets.

View joseluis's full-sized avatar
💭
dreamin' n workin'

José Luis Cruz joseluis

💭
dreamin' n workin'
View GitHub Profile
@joseluis
joseluis / rust_release_dates.rs
Last active November 12, 2024 12:12
Shows dates of next and previous Rust releases, from the detected rustc version, with current date fallback
#!/usr/bin/env -S rust-script -c
//! ```cargo
//! [dependencies]
//! jiff = "0.1"
//! ```
//
// Links for next releases:
// - https://releases.rs/
// - https://github.com/rust-lang/rust/milestones
// - https://doc.rust-lang.org/edition-guide/rust-2024/index.html
@joseluis
joseluis / playground.rs
Created September 15, 2021 22:00 — forked from rust-play/playground.rs
Code shared from the Rust Playground
//! this script recreates the book
//! "It's not a sin: An Introduction to the Trigonometric Values of Standard Functions"
extern crate rand; // 0.8.4;
use rand::prelude::*;
const DEGREES_RANGE: std::ops::RangeInclusive<i16> = -2000..=2000;
const NUMBER_QUESTIONS: i16 = 20; // questions per function. 250 in the book
fn main() {
let mut rng = thread_rng();
let functions: Vec<(&str, fn(f64) -> f64)> =
vec![("sin", f64::sin), ("cos", f64::cos), ("tan", f64::tan)];
@joseluis
joseluis / .rustfmt.toml
Created August 14, 2020 18:58 — forked from Robbepop/.rustfmt.toml
.rustfmt.toml with all configs, descriptions, parameters and defaults for version 0.7.1 of rustfmt.
# ----------------------------------------------------------------------------------
# r u s t f m t - C O N F I G
# ==================================================================================
#
# Version: 0.7.1
# Author : Robbepop <robbepop@web.de>
#
# A predefined .rustfmt.toml file with all configuration options and their
# associated description, possible values and default values for use in other
# projects.
@joseluis
joseluis / playground.rs
Last active April 13, 2019 18:48 — forked from rust-play/playground.rs
abstracting over fields with trait abuses: reddit.com/r/rust/comments/bc2w4m/announcing_rust_1340/eks8tq5/?context=3
trait Field {
type ValueType;
}
use std::marker::PhantomData as Marker;
struct X<T>(Marker<T>);
struct Y<T>(Marker<T>);
struct Z<T>(Marker<T>);
// import_json_appsscript.js
// https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4
//
// Changelog:
// (Jul. 16 2018) tag: allenyllee-20180716
// 1. Fixed the issue "If you try to query /arrayA[k]/arrayB[n]/arrayC[m]/.../member, you will always get /arrayA[k]/arrayB[k]/arrayC[k]/.../member."
// (Nov. 30 2017) tag: allenyllee-20171130
// 1. Add the ability to query array elements by using xpath like "/array[n]/member" where "n" is array index
// 2. Fixed Issue: when the path and the rule partially matched but not under the same xpath, it will still print that value under that xpath.
#!/usr/bin/env python
import asyncio
import websockets
import binascii
import ujson as json
method_map = {
'6d01': 'Set Name',
'6d02': 'Post Memo',
@joseluis
joseluis / README.md
Created November 14, 2017 12:54 — forked from obihann/README.md
Two Python scripts to help RES (Reddit Enhancement Suite) users manage their backups and convert between platforms.
@joseluis
joseluis / functions.php
Created May 4, 2017 12:00 — forked from jameskoster/functions.php
WooCommerce - Remove product data tabs
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;
@joseluis
joseluis / uuid.sh
Created February 8, 2017 18:34 — forked from markusfisch/uuid.sh
Generate a random UUID in bash
#!/usr/bin/env bash
# Generate a pseudo UUID
uuid()
{
local N B C='89ab'
for (( N=0; N < 16; ++N ))
do
B=$(( $RANDOM%256 ))
@joseluis
joseluis / commitstrip-dl
Last active April 15, 2019 11:09
download all the commitstrip strips
#!/usr/bin/env bash
#
# name : commitstrip-dl
# description : download all the commitstrip strips
# version : 1.0.0
# author : José Luis Cruz © 2017
# dependencies: bash<=4 curl [sxiv]
# license : MIT
#