Skip to content

Instantly share code, notes, and snippets.

View cgcardona's full-sized avatar
💭
🤖

Gabriel Cardona cgcardona

💭
🤖
View GitHub Profile
@cgcardona
cgcardona / get_by_struct.rs
Last active November 7, 2019 22:19 — forked from rust-play/playground.rs
Query a Rust HashMap by struct as key
// get by struct
use std::collections::HashSet;
#[derive(Hash, Eq, PartialEq, Debug)]
struct City {
name: String,
population: usize,
}
fn main() {
@cgcardona
cgcardona / playground.rs
Last active November 6, 2019 17:05 — forked from rust-play/playground.rs
Code shared from the Rust Playground
// You can run a single test by passing the name of that test to `cargo test`
#[test]
fn does_stuff() {
let t: bool = true;
t
}
// To run this test from the command line:
// cargo test does_stuff
@cgcardona
cgcardona / playground.rs
Created November 6, 2019 00:21 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::sync::Arc;
use std::thread;
fn main() {
let five: Arc<i32> = Arc::new(5);
for _ in 0..10 {
let five: Arc<i32> = Arc::clone(&five);
thread::spawn(move || {
@cgcardona
cgcardona / _scripttemplates.md
Last active June 5, 2018 15:57 — forked from dcousens/_scripttemplates.md
Transaction / Script Templates
  • <> represents data or script
  • {} represents data that must prefixed by OP_PUSHDATA
  • [] represents multiple {}

Standard Scripts

PubKey (pay-to-pubkey / P2PK)

Address: N/A
scriptPubKey: {pubKey} OP_CHECKSIG
<?php
trait WP_Widget_Inputs {
public function form_input_text( array $args = array() ) {
if ( !empty ( $args ) ) {
$id = esc_attr( $args['id'] );
printf(

Notes from Noisebridge

Hot corners

  1. Apple
  2. System Preferences
  3. Desktop/Screen Saver
  4. Hot corners button

Markdown

@cgcardona
cgcardona / gist:4637067
Last active December 11, 2015 17:48 — forked from anonymous/gist:4637055
#define digitalvaluesize 50
int digitalVoltage[digitalvaluesize];  // array for storing Voltage ADC values
int digitalMinusVoltage[digitalvaluesize];  // array for storing MinusVoltage ADC values
int digitalACAmps[digitalvaluesize];  // array for storing ACAmps ADC values
int digitalMinusAmps[digitalvaluesize];  // array for storing MinusAmps ADC values
int digitalvalueindex = 0;   // where are we in the indices
unsigned long digitalvalueadder;  //this is used to sum each array before division
void getVoltages(){