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
registry = {} | |
class Meta(type): | |
def __new__(mcs, name, bases, namespace): | |
cls_instance = super().__new__(mcs, name, bases, namespace) | |
registry[getattr(namespace['Meta'], 'system_name')] = cls_instance | |
return cls_instance | |
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
from functools import reduce | |
from operator import mul | |
class Solution(object): | |
def __init__(self): | |
self.solution = [[None] * 3, [None] * 3, [None] * 3] | |
self._row = self._column = 0 | |
def row_product(self, i): |
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
There are a few steps to be followed when setting up opam to use musl-libc. | |
1. Install musl-tools - this adds the wrapper musl-gcc to the system. | |
2. export CC=musl-gcc | |
3. Any supporting C libraries will need to be compiled with musl and installed in a special prefix, eg | |
apt-get source libgmp-dev # get the source for libgmp | |
CC=musl-gcc ./configure --prefix=/usr/local/musl # make sure the libs and headers are compiled with the right compiler and end up in a special path | |
4. Export the following variables to make sure opam finds them |
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
Kotlin ========================================================== | |
fun flipBit(): Long { | |
val start = System.currentTimeMillis() | |
var bit = false | |
for (i in 1..100000000) { | |
if (i % 7 == 0) { | |
bit = !bit | |
} | |
} |
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
struct Node { | |
host_name: String, | |
is_master: bool, | |
} | |
enum ParserResponse { | |
ParseError(usize, usize), | |
AddNodeCommand(String, bool), | |
RemoveNodeCommand(Node) | |
} |
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
DPI mode: per-monitor v2 | |
startup, version: 3176 windows x64 channel: stable | |
executable: /C/Program Files/Sublime Text 3/sublime_text.exe | |
working dir: /C/Program Files/Sublime Text 3 | |
packages path: /C/Users/abhijat/AppData/Roaming/Sublime Text 3/Packages | |
state path: /C/Users/abhijat/AppData/Roaming/Sublime Text 3/Local | |
zip path: /C/Program Files/Sublime Text 3/Packages | |
zip path: /C/Users/abhijat/AppData/Roaming/Sublime Text 3/Installed Packages | |
ignored_packages: ["Vintage"] | |
pre session restore time: 0.299623 |
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 ( | |
"net/http" | |
"log" | |
"golang.org/x/net/html" | |
"regexp" | |
"fmt" | |
"errors" | |
"bytes" |
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 am; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; | |
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; | |
import org.springframework.http.MediaType; | |
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders; | |
import org.springframework.restdocs.payload.FieldDescriptor; |