Skip to content

Instantly share code, notes, and snippets.

View NonymousMorlock's full-sized avatar
🏠
Working from home

NonymousMorlock

🏠
Working from home
View GitHub Profile
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart';
// sample code
/*
class CornerDecorationTest extends StatefulWidget {
@override
_CornerDecorationTestState createState() => _CornerDecorationTestState();
}

Animated SVG Avatar

Created a login form with an SVG avatar that responds to the input in the email field. Used the GSAP TweenMax library + GSAP's MorphSVG plugin for the animating.

Email validation is very simple and crude just for the purposes of getting this prototype working.

A Pen by Darin on CodePen.

License.

@NonymousMorlock
NonymousMorlock / lintool.sh
Created November 17, 2022 10:30 — forked from akyunus/lintool.sh
lintool is a bash script for flutter projects to automate checks before creating a Pull Request
#!/bin/bash
#minimum code coverage value
coverage_limit=70
exit_message () {
echo "\e[1;31m 😅 Lintool failed.\n 🪛 Check the issues.\n 🐝 Run again.\e[0m"
exit 0
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double amount = 100000;
double interest = 0.08;
double total = 0;
#include <iostream>
#include <iomanip>
using namespace std;
int power(int x, int y)
{
int total = 1;
for (int i = 1; i <= y; i++)
{
total *= x;
#include <iostream>
#include <iomanip>
using namespace std;
int question1()
{
#include <semaphore.h>
#include <pthread.h>
#include <stdio.h>
sem_t mutex;
sem_t db;
int readcount;
void *reader(void *arg)
{
using System;
using System.Threading;
class Program
{
static int data = 0;
static ReaderWriterLock rwlock = new ReaderWriterLock();
static void Main(string[] args)

C++

Here are the outcomes under the different scenarios:

  • If a reader comes first, it will be able to read the data in the database.
  • If a reader is using the database and another reader comes along, the second reader will also be able to read the data in the database.
  • If a writer comes along while a reader is active, the writer will wait until the reader is finished before it can write to the database. If a supply of readers arrives after the writer, they will also have to wait until the writer is finished before they can read the data in the database.
  • If a reader arrives and a writer is waiting, the writer will have to wait until the reader is finished before it can write to the database.

This program creates 10 reader threads and 2 writer threads. The reader threads continually read the value of the database variable, while the writer threads continually update it. The ReaderWriterLockSlim class is used to synchronize access to the database variable. When a writer thread acquires a write lock,

import json
import re
import sys
class Colour:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'