Skip to content

Instantly share code, notes, and snippets.

View devwebcl's full-sized avatar

German Gonzalez-Morris devwebcl

View GitHub Profile
@devwebcl
devwebcl / pointer1.c
Last active August 18, 2023 20:19
An austere program using C pointers.
// Program x.y An austere program using C pointers.
/*
1. num's address: 0x7ffe83ecb46c
2. num's value: 13
3. pt's address: 0x7ffe83ecb470
4. pt' size: 8 bytes
5. pt's value: 0x7ffe83ecb46c
6. value pointed to: 13
7. new num value to: 18
import time
import gym
#env = gym.make('MsPacman-v4')
env = gym.make('MsPacman-v4', render_mode='human')
num_episodes = 10
for i in range(1, num_episodes):
state = env.reset()
totalReward = 0
@devwebcl
devwebcl / Premium.java
Created January 14, 2021 12:27
pojo with toBuilder impl
package cl.devweb.constructor;
import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Builder(toBuilder=true)
@devwebcl
devwebcl / CopyConstructorPocLombok.java
Created January 14, 2021 12:26
copy constructor poc using Lombok
package cl.devweb.constructor;
public class CopyConstructorPocLombok {
public static void main(String[] args) {
Premium premium1 = new Premium("pi", 3.14);
Premium premium2 = premium1.toBuilder().build(); //copy constructor
Premium premium3 = premium1;
@devwebcl
devwebcl / ClienteClonePoc.java
Created January 14, 2021 12:26
Poc of cloning object by using copy-constructor and .clone()
package cl.devweb.constructor;
public class ClienteClonePoc {
public static void main(String[] args) {
try {
Cliente cliente1 = new Cliente(1, "joe");
Cliente cliente2 = (Cliente) cliente1.clone();
@devwebcl
devwebcl / Cliente.java
Created January 14, 2021 12:25
pojo with copy constructor and clone()
package cl.devweb.constructor;
public class Cliente implements Cloneable {
int rut;
String nombre;
Cliente(int rut, String nombre) {
this.rut = rut;
this.nombre = nombre;
@devwebcl
devwebcl / pthreads-p339.c
Last active December 5, 2020 15:28
threads c11
#include <pthread.h>
#include <stdio.h>
int *dowork(void *arg)
{
pthread_t mythreadid = pthread_self();
for (int i = 0; i < 5; i++) {
printf("Thread id: %lu, counter: %d, code: %s\n", mythreadid, i, (char *)arg);
}
<dependency>
<groupId>com.doctusoft</groupId>
<artifactId>json-schema-java7</artifactId>
<version>1.4.1</version>
</dependency>
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id_schema": "1",
"title": "Journal nuevo",
"description": "persistencia en el modelo de Journal",
"version": "1.0.0",
"type": "object",
"definitions": {
"dataAuditoria": {