Skip to content

Instantly share code, notes, and snippets.

View umutyerebakmaz's full-sized avatar
:octocat:
I'm available, please open an issue on the subject.

Umut Yerebakmaz umutyerebakmaz

:octocat:
I'm available, please open an issue on the subject.
View GitHub Profile
@umutyerebakmaz
umutyerebakmaz / killmail.json
Created April 8, 2024 10:09
Eve Online Example Killmail with hashcode from ingame
{
"attackers": [
{
"alliance_id": 99004804,
"character_id": 96780701,
"corporation_id": 215297637,
"damage_done": 1817,
"final_blow": true,
"security_status": 0.1,
"ship_type_id": 49710,
@umutyerebakmaz
umutyerebakmaz / laravel-websockets-ssl-lets-encrypt-certbot-supervisor-ubuntu.md
Last active February 1, 2024 10:26
Laravel-Websockets Deploy Nginx Virtualhost with SSL

Laravel-websockets, SSL Certificate, Let's Encrypt, Certbot, Supervisor, Digitalocean Ubuntu

I did two days work to run laravel-websockets on my server. It will be nice to share with you.

Steps

Step1 - Laravel Websockets Installation with composer

Laravel WebSockets can be installed via composer:

@umutyerebakmaz
umutyerebakmaz / request-user.entity.ts
Created January 11, 2024 09:29
TypeORM @manytomany, establish a two-sided `CASCADE` structure for the ManyToMany relationship.
// You can set up the structure without creating this entity, but when the project grows,
// you will need the entity for leftJoin.
import { BaseEntity, Entity, PrimaryColumn } from 'typeorm';
@Entity()
export class RequestUser extends BaseEntity {
@PrimaryColumn('uuid')
requestId: string;
@PrimaryColumn('uuid')
@umutyerebakmaz
umutyerebakmaz / rxjs-time-based-functions.ts
Last active November 28, 2023 15:51
RXJS time based functions
// bir sayine sonra bir değer üretir
const timer$ = timer(1000);
timer$.subscribe(value => {
console.log(value); // 0
});
// her bir saniyede bir artan değer üretir
const interval$ = interval(1000);
interval$.subscribe(value => {
@umutyerebakmaz
umutyerebakmaz / yoga-express-middleware.example.ts
Created October 13, 2023 12:32
yoga-express-middleware.example.ts
#!/usr/bin / env node
import express from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import '@lib/env';
import { authChecker } from './auth-checker';
import environmentErrorReporter from '@lib/environmentErrorReporter';
import { appDataSource } from '@server/datasource';
import { buildSchema } from 'type-graphql';
import { resolvers } from './modules/resolvers';
@umutyerebakmaz
umutyerebakmaz / apollo.service
Last active August 28, 2023 14:23
nginx proxy, custom daemon service, express-apollo, nodejs deployment formerly 2023 updated
[Unit]
Description=apollo.service
After=network.target
[Service]
User=root
Group=root
ExecStart=/bin/bash -c 'source /root/.nvm/nvm.sh && nvm use v16.20.2 && cd /var/www/server && yarn start'
Environment=NODE_ENV=production
StandardOutput=syslog
@umutyerebakmaz
umutyerebakmaz / server.ts
Last active August 14, 2023 15:00
Add your own JWT implementation for Apollo Server Express.
import bodyParser from 'body-parser';
import cors from 'cors';
import express from 'express';
import * as fs from 'fs';
import * as jwt from 'jsonwebtoken';
const accessKey = fs.readFileSync('src/keys/access_token_pkcs8.key', 'utf-8');
const refreshKey = fs.readFileSync('src/keys/refresh_token_pkcs8.key', 'utf-8');
const app = express();
import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http';
import { Observable, BehaviorSubject } from 'rxjs';
import { catchError, filter, switchMap, take } from 'rxjs/operators';
import { AuthService } from '@services/auth.service';
import { Router } from '@angular/router';
import { TokenType } from '@app/graphql.module';
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
@umutyerebakmaz
umutyerebakmaz / keypair.py
Last active July 31, 2023 14:16
Generate 256bit keypair accessToken and refreshToken case
// Generate AccesToken keypair
openssl genrsa -out access_token.pem 2048
openssl rsa -in access_token.pem -pubout -out access_token_publickey.crt
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in access_token.pem -out access_token_pkcs8.key
// Generate RefreshToken keypair
openssl genrsa -out refresh_token.pem 2048
openssl rsa -in refresh_token.pem -pubout -out refresh_token_publickey.crt
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in refresh_token.pem -out refresh_token_pkcs8.key
<div x-data="{
value: {{ value }} ?? '',
displayValue: {{ value }} ?? '',
demaskValue(value) {
this.value = value.replaceAll('$', '').replaceAll(',', '')
}
}" class="-mr-2">
<input
type="text"
x-mask:dynamic="'$' + $money($input)"