Skip to content

Instantly share code, notes, and snippets.

View diegopacheco's full-sized avatar

Diego Pacheco diegopacheco

View GitHub Profile
@diegopacheco
diegopacheco / test.md
Created September 2, 2023 06:10 — forked from ityonemo/test.md
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@diegopacheco
diegopacheco / jq-cheetsheet.md
Created July 20, 2023 02:57 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support

Enable repair by private ip

First open cassandra-env.sh

sudo vim /opt/reuters/apps/cassandra/conf/cassandra-env.sh

we need to change some configuration

@diegopacheco
diegopacheco / Monad.scala
Created June 26, 2018 23:00 — forked from johnynek/Monad.scala
Short Monad Example in Scala
// Run this with: scala Monad.scala
trait Monad[M[_]] {
// in haskell, called return, but that's a reserved word
// constructs a Monad instance from the given value, e.g. List(1)
def apply[T](v: T): M[T]
// flatMap function, in scala:
def bind[T,U](m: M[T])(fn: (T) => M[U]): M[U]
// Laws these must follow are:
// identities:

Install git-pylint-commit-hook

$ pip install git-pylint-commit-hook

Add git pylint to a git repo as a hook

$ cd my_git_repo/.git/hooks
$ echo '#!/bin/sh
git-pylint-commit-hook
' > pre-commit
@diegopacheco
diegopacheco / build.gradle
Created July 30, 2016 00:22 — forked from michail-nikolaev/build.gradle
Gradle - force transitive dependency version for some group
apply plugin: 'java'
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
//specifying a fixed version for all libraries with 'org.gradle' group
if (details.requested.group == 'org.springframework') {
details.useVersion "$springVersion"
}
}
@diegopacheco
diegopacheco / 0_reuse_code.js
Created June 21, 2016 20:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Install collectd on Ubuntu 14.04

curl http://pkg.ci.collectd.org/pubkey.asc | sudo apt-key add -
sudo bash -c  'echo "deb http://pkg.ci.collectd.org/deb/ trusty collectd-5.5" > /etc/apt/sources.list.d/collectd-ci.list'
sudo apt-get update
sudo apt-get install collectd # This should install collectd version 5.5.x

Install Influxdb on Ubuntu 14.04