Skip to content

Instantly share code, notes, and snippets.

View MufidJamaluddin's full-sized avatar

Mufid Jamaluddin MufidJamaluddin

  • Jakarta, Indonesia
View GitHub Profile
@MufidJamaluddin
MufidJamaluddin / Program.cs
Last active April 18, 2021 04:03
ASP.NET Core Asinkronus
namespace WebAPI
{
public class Program
{
public static void Main(string[] args)
{
// Batasi maksimal thread jadi sesuai dengan jumlah CPU
var processorCounter = Environment.ProcessorCount;
ThreadPool.SetMaxThreads(
processorCounter,
const daftarSupir: Array<any> = []
function supir({ nama, mobil }: { nama: string, mobil: string }) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
daftarSupir.push({ nama, mobil, propertyKey, target })
};
}
function timeout(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
var emailChannel chan *viewmodels.EmailMessage
var emailChannelClosed bool
func SendMessage(message *viewmodels.EmailMessage) {
emailChannel <- message
}
func Open() {
emailChannel = make(chan *viewmodels.EmailMessage)
@MufidJamaluddin
MufidJamaluddin / run.sh
Last active October 3, 2020 17:31
Command
#!/bin/bash
if ! pgrep -f 'binary_app'
then
nohup /home/file_path/binary_app && echo "baru running" > ./out_test.txt
else
echo "udah di-run" > ./out_test.txt
fi
@MufidJamaluddin
MufidJamaluddin / middleware.cs
Last active August 6, 2024 01:53
Middleware JWT in Cookie
/**
* Middleware Handle JWT in Cookie
* @author Mufid Jamaluddin
**/
namespace IssueTracker.Middleware
{
public static class JwtInCookieMiddleware
{
public const string JWT_COOKIE_KEY = "token";
namespace IssueTracker
{
public class Startup
{
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IssueTrackerDbContext dbContext, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
namespace IssueTracker.Controller
{
[Route("api/[controller]")]
public class TicketController : Controller
{
private ITicketServices TicketServices { get; }
public TicketController(ITicketServices TicketServices)
{
this.TicketServices = TicketServices;
namespace IssueTracker
{
public class Startup
{
public virtual void ConfigureDatabase(IServiceCollection services)
{
if (!int.TryParse(Configuration["DatabasePool"], out int dbPoolSize))
{
dbPoolSize = DEFAULT_MAX_POOL_SIZE;
}
namespace IssueTracker.Services
{
public class TicketServices : ITicketServices
{
private ITicketRepository TicketRepository { get; }
private ITransactionRepository TransactionRepository { get; }
private ILogger<TicketServices> Logger { get; }
private IssueTrackerDbContext DbContext { get; }
public TicketServices()
@MufidJamaluddin
MufidJamaluddin / student.java
Created April 20, 2020 16:21
Penggunaan Hibernate Envers
@Entity
@Audited
class Student extends Serializable
{
@Version
private Integer version;
String NISN;
String fullName;
Float GPA;