Skip to content

Instantly share code, notes, and snippets.

:octocat:
:)

Cosmin Popescu cosminpopescu14

:octocat:
:)
View GitHub Profile
View JavaPlayTodosApi.java
package com.company;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
View MavenSupportConfigForJava.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>JsonApiPlay</artifactId>
<version>1.0-SNAPSHOT</version>
View JavaPlay.java
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;
View DifferentApproachesToGetSchema.cs
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 Apr 25, 2020
Generate a rgb color from a hashcode
View FromHashcodeToColor.cs
using System;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using HashcodeToColor;
namespace HashcodeToColor
{
@cosminpopescu14
cosminpopescu14 / main.cs
Created Mar 22, 2020 — forked from gistlyn/main.cs
Simple OrmLite CRUD demo
View main.cs
using System;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
public class User
{
View count_duplicate_properties_from_array_of_objects.js
const clienti = [
{ idClient: 121, idJudet: 1 },
{ idClient: 221, idJudet: 1 },
{ idClient: 343, idJudet: 2 }];
let dupes = {};
let rez = [];
clienti.forEach(count => {
View growth_rate_coronavirus.sql
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;
View corona-virus-app-case-table.sql
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
View RunnableLambdaParam.java
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());
You can’t perform that action at this time.