Skip to content

Instantly share code, notes, and snippets.

@alexnum
alexnum / Singleton Pattern.cs
Created September 13, 2022 16:37 — forked from OmegaExtern/Singleton Pattern.cs
Singleton Pattern in C#.
#region Singleton Pattern
// NOTE: The class is marked as sealed to prevent the inheritance of the class (i.e. use it as base/super class).
internal sealed class Singleton
{
private static readonly object SingletonSyncRoot = new object();
private static volatile Singleton _instanceSingleton;
// NOTE: Default/Parameterless constructor is private to prevent instantiation of the class.
private Singleton()
@alexnum
alexnum / .emacs
Last active June 3, 2022 18:10
My Emacs 28 linux config
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(grep-find-ignored-directories
(quote
("SCCS" "RCS" "CVS" "MCVS" ".src" ".svn" ".git" ".hg" ".bzr" "_MTN" "_darcs" "{arch}" "node_modules" "bower_components" "packages" "DotNetZip" "nHapi")))
'(inhibit-startup-screen t)
'(menu-bar-mode nil)
@alexnum
alexnum / index.js
Last active March 13, 2022 21:07
Lambda function to send emails using node mailer
require('dotenv').config()
var nodemailer = require('nodemailer');
const {EMAIL_SERVICE, EMAIL, EMAIL_PASSWORD, PORT} = process.env;
var transporter = nodemailer.createTransport({
service: EMAIL_SERVICE,
auth: {
user: EMAIL,
find -name "* *" -type f | rename 's/ /_/g'
list=$(ls ./ | grep .mkv)
i=0;
for file in $list
do
BASE_FILE_NAME=$(echo $file | awk -F".mkv" '{print $1}')
mkvextract tracks ./$file 2:./${BASE_FILE_NAME}.srt
startTimeLine=$(cat ${BASE_FILE_NAME}.srt | grep "Episode Title" | head -n 2 | tail -1 | sed 's/^.*\( 0,0.*\)/\1/g')
startTime=$(node -e "console.log('${startTimeLine}'.split(',')[1].split('.')[0])")
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
@alexnum
alexnum / cruz.py
Last active August 30, 2017 02:57
import random
import time
from collections import Counter
import matplotlib.pyplot as plt
import math
x = 0;
y = 1;
EULER = math.exp(1)
BETA = 1
------------------------ Atividade 2 ---------
2.1 "Como visto em aula, fos principais princípios para construção de
um MSN são"- Alessandro
2.2.a "Especifique o algorítmo para um método misto para extração
de raízes usando o MSN de Bisseção e o de Newton-Raphson (NR)" - ̶F̶e̶l̶i̶p̶e̶ Alessandro --- PRIORITARIA---
2.2.b "Forneça um exemplo numérico que ilustre as vantagens de usar
seu método misto acima – i.e., especifique uma f(x)" - ̶C̶é̶s̶a̶r̶ Alessandro
#!/usr/bin/python
#Só funciona para o site https://lermangasonline.xyz
#Exemplo de execução:
#Recebe 3 argumentos:
#primeiro: Url para o manga
#Segundo e Terceiro: Do capitulo X até o capitulo Y, sendo X o segundo argumento e Y o terceiro.
#Exemplo:
#python main.py https://lermangasonline.xyz/sys_mangas/00sdfrw/S/shingeki-no-kyojin 61 90
import sys
@alexnum
alexnum / cls.js
Last active April 12, 2017 14:37
Cluster
var positions = [];
$('.stone.t5').each(function() {
if(parseFloat($(this).css('left').replace('px','')) != 0 ) positions.push([
parseFloat($(this).css('left').replace('px','')),
parseFloat($(this).css('top').replace('px',''))
]);
});
copy(JSON.stringify(positions))
//NODE