This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cats.effect.IO | |
| object Impure { | |
| def pureAddIntPair(x: Int, y: Int): Int = x + y | |
| // Possible side effect: NumberFormatException | |
| // => No Referential Transparency | |
| def impureParseInt(s: String): Int = Integer.parseInt(s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed trait IO[+A] { | |
| def unsafeRunSync(): A | |
| def flatMap[B](f: A => IO[B]): IO[B] = IO.FlatMap(this, f) | |
| def map[B](f: A => B): IO[B] = flatMap(f andThen IO.pure _) | |
| // -------------------- Sync Maniputation Methods ---------------------------- | |
| def attempt: Either[Throwable, A] = scala.util.Try(unsafeRunSync()).toEither |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| const step int = 8 | |
| const mask int = ^(-1 << step) // NOT(-1 << 8) | |
| type RGB struct { | |
| Red int | |
| Green int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Main { | |
| import scala.language.higherKinds | |
| /** | |
| * Functor contains a function | |
| * that maps from a category to another | |
| */ | |
| trait Functor[F[_]] { | |
| def map[A, B](fa: F[A])(f: A => B): F[B] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object HideText { | |
| type Homoglyphs = Map[Char, Array[Char]] | |
| val homoglyphsDict: Homoglyphs = Map( | |
| ' ' -> Array("2000","2001","2002","2003","2004","2005","2006","2007","2008","2009","200A","2028","2029","202F","205F"), | |
| '!' -> Array("FF01"), | |
| '"' -> Array("FF02"), | |
| '$' -> Array("FF04"), | |
| '%' -> Array("FF05"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <time.h> | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <termios.h> | |
| char *swag = " #include <time.h>\n #include <stdio.h>\n #include <unistd.h>\n #include <stdlib.h>\n #include <string.h>\n #include <termios.h>\n\n char *swag = \"[SOME CODE HERE]\";\n\n void showContent(char *content)\n {\n int i, ran;\n char buf, c;\n struct termios oldt, newt;\n\n i = 0;\n tcgetattr(STDIN_FILENO, &oldt);\n newt = oldt;\n newt.c_lflag &= ~(ICANON | ECHO);\n tcsetattr(STDIN_FILENO, TCSANOW, &newt);\n write(1, \"\\033c\", 2);\n while (read(0, &buf, 1) && buf != 4)\n {\n ran = rand() % 2 + 1;\n while (--ran > -1)\n {\n write(1, \"\\033[92m\", 5);\n\n c = content[i % strlen(content)];\n write(1, &c, 1);\n i++;\n\n write(1, \"\\033[0m\", 5);\n }\n }\n tcsetattr(STDIN_FILENO, TCSANOW, &oldt);\n write(1, \"\\n\", 1);\n}\n\n int main(void)\n {\n srand(time(NULL));\n showContent(swag);\n return (0);\n }\n\n"; | |
| void showContent( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This script is made to bypass proxy problems | |
| # You can connect to ssh server through proxy thanks to corkscrew | |
| # And then forward your port for your localhost, and use it on your web browser | |
| cork_config_file="$HOME/.ssh/cork.auth" | |
| ssh_config_file="$HOME/.ssh/config" | |
| hostname="" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| const int is_digit(const char c) { | |
| return c >= '0' && c <= '9'; | |
| } | |
| const int is_space(const char c) { | |
| return c >= 8 && c <= 32; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function primary_check { | |
| [[ `which wget` == "" ]] && sudo apt install wget | |
| [[ `which gnash` == "" ]] && sudo apt install gnash | |
| [[ `which wmctrl` == "" ]] && sudo apt install wmctrl | |
| } | |
| function read_swf_file_fullscreen_on_every_display { | |
| primary_check | |
| SWF_FILE=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Solution extends App { | |
| val expression = readLine.trim | |
| val asso = Map(')' -> '(', ']' -> '[', '}' -> '{') | |
| val isop = asso.values.toSet | |
| val iscl = asso.keys.toSet | |
| def cleanStack(c:Char)(implicit stack: List[Char]) = | |
| stack.filter(_ == c).tail ++ stack.filterNot(_ == c) |