Skip to content

Instantly share code, notes, and snippets.

View cosminpopescu14's full-sized avatar
🎯
Focusing

Cosmin Popescu cosminpopescu14

🎯
Focusing
View GitHub Profile
package com.company;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.util.Arrays;
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Text.Json;
using System.Threading.Tasks;
namespace JsonPlay
{
@cosminpopescu14
cosminpopescu14 / FromHashcodeToColor.cs
Last active April 25, 2020 15:24
Generate a rgb color from a hashcode
using System;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using HashcodeToColor;
namespace HashcodeToColor
{
@cosminpopescu14
cosminpopescu14 / main.cs
Created March 22, 2020 15:28 — forked from gistlyn/main.cs
Simple OrmLite CRUD demo
using System;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
public class User
{
const clienti = [
{ idClient: 121, idJudet: 1 },
{ idClient: 221, idJudet: 1 },
{ idClient: 343, idJudet: 2 }];
let dupes = {};
let rez = [];
clienti.forEach(count => {
USE `coronavirus`;
DROP procedure IF EXISTS `calculate_growth_rate`;
DELIMITER $$
USE `coronavirus`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `calculate_growth_rate`()
BEGIN
DECLARE last_case INT DEFAULT 0;
CREATE TABLE `cases` (
`id` bigint(20) NOT NULL,
`cases` bigint(20) DEFAULT NULL,
`date` date DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT date_cases UNIQUE (cases , date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
static Runnable task = Main::socketPlay;
private static void socketPlay() {
int count = 0;
try (var serverSocket = new ServerSocket(80)){
var socket = serverSocket.accept();
try (var output = new PrintWriter(socket.getOutputStream(), true)) {
while (count <=10) {
output.println(generateRandomStrings());
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
int[][][] threeDimArr = { { { 1, 2 }, { 3, 4 } }, { { 5, 6 }, { 7, 8 } } };
var flattenedArray = Arrays.stream(threeDimArr)
.flatMap(Arrays::stream)
.flatMapToInt(Arrays::stream);
flattenedArray.forEach(System.out::println);