Skip to content

Instantly share code, notes, and snippets.

Avatar
🙂

Nicolas Zozol nicolas-zozol

🙂
View GitHub Profile
View gist:8bcb215a629488549166059db7d99f35
[Unit]
Description=My app
After=syslog.target
[Service]
User=www-data
Type=simple
ExecStart=/home/myuser/mywebsite/node_modules/next/dist/bin/next start -p $PORT
SuccessExitStatus=130
RestartSec=3
Restart=on-failure
@nicolas-zozol
nicolas-zozol / sonoff.js
Created Jan 6, 2021
Sonoff basic javascript code
View sonoff.js
require('dotenv').config()
const ewelink = require('ewelink-api')
const credentials = {
username: process.env.EMAIL,
password: process.env.PASSWORD
}
const devices = {
lili: process.env.LILI // device Id
@nicolas-zozol
nicolas-zozol / docker-compose.yml
Created Jan 29, 2020
Adminer + Postgres docker-compose
View docker-compose.yml
---
version: "3.3"
services:
# POSTGRES: https://github.com/docker-library/postgres
db:
image: postgres
container_name: db
#restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
@nicolas-zozol
nicolas-zozol / option.ts
Created Sep 12, 2019
Optional in typecript
View option.ts
export class Optional<T> {
constructor(public value:T) {
}
isPresent():boolean {
return this.value !== null && this.value !== undefined;
}
map(bindCall):Optional<T> {
View ts-lint rules
"rules": {
"no-consecutive-blank-lines": true,
"interface-over-type-literal": false,
"trailing-comma":false,
"object-literal-sort-keys":false,
"member-access":false,
"interface-name":false,
"arrow-parens":false
},
View responds-to-more.scss
// Using media-query to generate some common hide/show css classes.
// Work in Progress, works with my projects.
// !important is sometimes needed with bootstrap, you should try to remove it first.
// Most of the time, I just pick one between laptop or desktop
// Extra small screen / phone ;
$mobileMax: 480px;
// Small screen / tablet
$tabletMax: 850px;
// laptops :
View persistence.xml working in JPA with MySQL - RESOURCE_LOCAL for good start
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="funkopop" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/funkopop" />
<property name="javax.persistence.jdbc.user" value="admin" />
View CorsFilter.java
package io.pax.cryptos.ws;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by nicorama and others on 09/02/2018.
View youtube-dl
youtube-dl https://www.youtube.com/watch?v=BLvFgrwghkQ
View .idea vm Options
-XX:ReservedCodeCacheSize=1024m
-XX:SoftRefLRUPolicyMSPerMB=50
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m