Skip to content

Instantly share code, notes, and snippets.

Dviejo Dviejopomata

  • Alicante, Spain
View GitHub Profile
View DbExtensions.cs
public static class DbExtensions
{
public static IQueryable<T> FilterByTenant<T>(this IQueryable<T> baseEntities, string
tenantId) where T : BaseEntity
{
return baseEntities.Where(r => r.TenantId == tenantId);
}
public static IQueryable<T> FilterByTenantName<T>(this IQueryable<T> baseEntities, string
tenantId) where T : BaseEntity
{
View main.cpp
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int splitByDelim(char *str, char *delim, int *out) {
char *pt;
pt = strtok(str, delim);
View generate.py
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(100)
delta = np.random.uniform(-10, 10, size=(100,))
y = -.3 * x + 3 + delta
print(delta)
plt.plot(x, y)
plt.show()
@Dviejopomata
Dviejopomata / main.kt
Created Oct 4, 2018
Show android notification with alarm sound
View main.kt
val textTitle = "Title"
val textContent = "Content"
val alarmSound = Settings.System.DEFAULT_ALARM_ALERT_URI
val mBuilder = NotificationCompat.Builder(this, "alarm-1")
.setSmallIcon(R.drawable.navigation_empty_icon)
.setContentTitle(textTitle)
.setContentText(textContent)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setSound(alarmSound, AudioManager.STREAM_ALARM)
View http-raw-request
POST /main.fbddd1fc85fb802220eb.js HTTP/1.1
Host: frontend-ng.nextagilesoft.com
CONTENT
View wait-for-server.sh
IP=$1
PORT=$2
echo "Waiting for $IP to be accesible on $PORT..."
while ! nc -z $IP $PORT; do
sleep 0.5
done
notify-send "Server $IP is up"
View LoadCertificate.cs
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Pkcs;
using Org.BouncyCastle.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using X509Certificate = Org.BouncyCastle.X509.X509Certificate;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
@Dviejopomata
Dviejopomata / cmds-openssl.md
Last active Sep 19, 2018
Openssl common certificates
View cmds-openssl.md

Der to pem

openssl x509 -inform der -in file.cer -out file.pem

Pem to der

openssl x509 -in file.pem -out file.cer -outform der
View app.yaml
app: printv3
company: nextagilesoft
config: {}
dependencies:
postgresql:
version: 10.6
handlers:
View build.go
package build
import (
"context"
"github.com/docker/docker/api/types"
"github.com/docker/docker/builder/dockerignore"
"github.com/docker/docker/builder/remotecontext/git"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/idtools"
You can’t perform that action at this time.