Skip to content

Instantly share code, notes, and snippets.

💭
:)

Cosmin Popescu cosminpopescu14

💭
:)
Block or report user

Report or block cosminpopescu14

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View quarkus_errors.log
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.acme:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
View IsConsecutive.java
package com.company;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int array[] = {1,2,1,2,3,3};
System.out.println(isConsecutive());
}
View Decrypt.cs
private byte[] DecryptAes(byte[] data, byte[] password)
{
byte[] array = null;
byte[] bytes = Encoding.Default.GetBytes(configuration.Salt);
using (MemoryStream memoryStream = new MemoryStream())
{
using (RijndaelManaged rijndaelManaged = new RijndaelManaged())
{
rijndaelManaged.KeySize = 256;
rijndaelManaged.BlockSize = 128;
View Encrypt.cs
private byte[] EncryptAes(byte[] data, byte[] password)
{
byte[] array = null;
byte[] bytes = Encoding.Default.GetBytes(configuration.Salt);
using (MemoryStream memoryStream = new MemoryStream())
{
using (RijndaelManaged rijndaelManaged = new RijndaelManaged())
{
rijndaelManaged.KeySize = 256;
rijndaelManaged.BlockSize = 128;
View JavaExperiment.java
import java.util.Arrays;
import java.util.Date;
import java.util.stream.*;
import java.util.*;
class Main {
public static void main(String[] args) {
int v[] = {1,2,3,4,5,6,7,8,9,10};
Arrays.stream(v)
@cosminpopescu14
cosminpopescu14 / main.go
Created Aug 14, 2019 — forked from geosoft1/main.go
Simple blockchain example
View main.go
package main
import (
"crypto/sha256"
"encoding/hex"
"strconv"
"time"
)
type Data struct {
View remove_duplicates_from_array_objects_underscore.js
let _ = require('underscore');
let data = [ { Data: 2019, IdJudet: "09,18" }, { Data: 2019, IdJudet: "09,18, 20, 03" }, { Data: 2019, IdJudet: "09" }, { Data: 2019, IdJudet: null } ]
let collectedData = _.collect(data)
let counties = _.pluck(collectedData, 'IdJudet').join(',').replace(/\s+/g, '')
let noDupesCounties = _.uniq(counties.split(',').filter(Boolean))
console.log(noDupesCounties)
View remove_duplicates_from_array_objects.js
const data = [ { Data: 2019, IdJudet: "09,18" },
{ Data: 2019, IdJudet: "09,18, 20, 03" },
{ Data: 2019, IdJudet: "09" },
{ Data: 2019, IdJudet: null }
]
//filterz pt a elimina judetul null si unesc dupa IdJudet plus normalizez spatiile
const county = data.filter(j => j.IdJudet != null).map(j => j.IdJudet).join(',').replace(/\s+/g, '')
View remove_duplicates_from_json.js
json='[ { "Data": 2019, "IdJudet": "09,18" }, { "Data": 2019, "IdJudet": "09,18, 20, 03" }, { "Data": 2019, "IdJudet": "09" }, { "Data": 2019, "IdJudet": null } ]';
obj = JSON.parse(json)
const ids = obj
// get only the required field
.map((item) => item.IdJudet)
// filter away null values and empty strings
.filter(Boolean)
// split by comma and trim spaces
.map((IdJudet) => IdJudet.split(",").map(id => id.trim()))
View unsafe_string.cs
char[] chars = { 'w', 'o', 'r', 'd' };
sbyte[] bytes = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x00 };
// Create a string from a character array.
string string1 = new string(chars);
Console.WriteLine(string1);
// Create a string that consists of a character repeated 20 times.
string string2 = new string('c', 20);
Console.WriteLine(string2);
You can’t perform that action at this time.