Skip to content

Instantly share code, notes, and snippets.

View mancvso's full-sized avatar
🏠
Working from home

Alejandro Vidal Castillo mancvso

🏠
Working from home
View GitHub Profile
@milhomem
milhomem / clientCert.android.java
Last active April 18, 2024 21:18
How to connect using Client Certificate in Android with OkHttp
KeyStore keyStore = KeyStore.getInstance("PKCS12");
FileInputStream clientCertificateContent = new FileInputStream("/path/to/publicAndPrivateKey.p12");
keyStore.load(clientCertificateContent, "private key password".toCharArray());
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(keyStore, "private key password".toCharArray());
FileInputStream myTrustedCAFileContent = new FileInputStream("/path/to/embedded/CA-Chain.pem");
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
X509Certificate myCAPublicKey = (X509Certificate) certificateFactory.generateCertificate(myTrustedCAFileContent);
@joselitosn
joselitosn / pysmb.py
Created March 16, 2016 13:45
Python SMB Example
from smb.SMBConnection import SMBConnection
userID = 'user'
password = 'password'
client_machine_name = 'localpcname'
server_name = 'servername'
server_ip = '0.0.0.0'
domain_name = 'domainname'
package database;
import com.esotericsoftware.reflectasm.ConstructorAccess;
import com.esotericsoftware.reflectasm.FieldAccess;
import org.bson.*;
import org.bson.codecs.Codec;
import org.bson.codecs.DecoderContext;
import org.bson.codecs.EncoderContext;
import java.lang.reflect.Array;
@johnjansen
johnjansen / build.sbt
Last active November 24, 2017 16:43
AWS Lambda Microservice — Scala
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint")
lazy val root = (project in file(".")).
settings(
name := "lambda-demo",
version := "1.0",
scalaVersion := "2.11.4",
retrieveManaged := true,
libraryDependencies += "com.amazonaws" % "aws-lambda-java-core" % "1.0.0",
libraryDependencies += "com.amazonaws" % "aws-lambda-java-events" % "1.0.0",
@djspiewak
djspiewak / 0introduction.md
Last active November 28, 2023 15:03
Scala Collections Proposal

Collections Redesign Proposal

I'm going to start off by motivating what I'm doing here. And I want to be clear that I'm not "dissing" the existing collections implementation or anything as unproductively negative as that. It was a really good experiment, it was a huge step forward given what we knew back in 2.8, but now it's time to learn from that experiment and do better. This proposal uses what I believe are the lessons we can learn about what worked, what didn't work, and what is and isn't important about collections in Scala.

This is going to start out sounding really negative and pervasively dismissive, but bear with me! There's a point to all my ranting. I want to be really clear about my motivations for the proposal being the way that it is.

Problems

Generic Interfaces

@kensipe
kensipe / mesos-dns-setup-notes.md
Created May 29, 2015 17:03
details for setting up mesos-dns with docker

Mesos-DNS

Scripts for setting up

sudo mkdir /etc/mesos-dns
sudo vi /etc/mesos-dns/config.json

config.json

@timperrett
timperrett / unfiltered-webjars.md
Created April 29, 2015 20:01
Using WebJars with Scala Unfiltered

Add the relevant webjars to your build file:

  libraryDependencies += "org.webjars.bower" % "angular" % "1.3.15"

Add the resources to your server definition:

unfiltered.netty.Server
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@dmytrodanylyk
dmytrodanylyk / res_color_btn_flat_selector.xml
Last active March 4, 2023 07:52
Material Flat Button Style
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/flat_disabled_text"/>
<item android:color="@color/flat_normal_text"/>
</selector>
@fancellu
fancellu / MyQuote.scala
Last active June 8, 2016 22:11
Very simple example of Scala "string" Interpolation (more than just strings though)
//http://docs.scala-lang.org/overviews/core/string-interpolation.html
implicit class MyQuote(ctx:StringContext){
def x(args:String*):String=ctx.parts.zip(args).map{case (p,a)=>s"$p$a"}.mkString("")
}
val string="STRINGY"
val string2="STRINGY2"
println(x"Part1 $string Part2 $string2 Part3 $string")