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
| [Unit] | |
| Description=Choose an appropriate driver | |
| Before=display-manager.service | |
| [Service] | |
| Type=oneshot | |
| ExecStart=/bin/bash -c 'systemd-detect-virt && d=mesa || d=nvidia; d="$d-libgl lib32-$d-libgl"; pacman -Q $d || yes | pacman -S --needed $d' | |
| RemainAfterExit=yes | |
| [Install] |
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
| #!/usr/bin/env python2 | |
| # Requirements: Python, PyGTK, seems like it wants NumPy as well | |
| # Arch Linux: pygtk, python2-numpy | |
| # Use `xdotool getmouselocation` to find coordinates | |
| coords = (1864, 185) |
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 struct | |
| store_fn = 'store' | |
| #key_bits = 16 | |
| #value_bits = 16 | |
| #struct_format = 'H' | |
| key_bits = 32 | |
| value_bits = 32 | |
| struct_format = '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
| alias rm false | |
| parted /dev/?da | |
| mklabel msdos | |
| mkpart primary ext4 1MiB 100% | |
| set 1 boot on | |
| quit | |
| mkfs.ext4 /dev/sda1 | |
| mount /dev/sda1 /mnt | |
| mkdir /mnt/boot | |
| mount /dev/sda1 /mnt/boot |
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 functools | |
| from flask import Flask, g | |
| app = Flask(__name__) | |
| languages = ['en', 'hr'] | |
| def translate_to(lang, text): | |
| return { | |
| '/about': { | |
| 'hr': '/onama', |
The MIT License (MIT)
Copyright (C) 2015 Oleh Prypin blaxpirit@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
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
| module Indexable(T) | |
| def threadpool_map(workers : Int = 8, chunk_size : Int? = nil, &func : T -> R) forall T, R | |
| mutex = Thread::Mutex.new | |
| cs = chunk_size || (self.size**0.5).ceil.to_i | |
| Array(R).build(self.size) do |result| | |
| index = 0 | |
| threads = Array.new(workers) { | |
| Thread.new do | |
| a = b = 0 | |
| loop do |
- Array
- Deque (circular buffer)
- crystalline Deque (linked list)
crystal run --release bm.cr
| class | unshift pop unshift | push shift push | push pop | unshift shift | each | insert length/8 | insert length*3/5 |
|---|---|---|---|---|---|---|---|
| array | 1.405377 | 0.685335 | 0.015142 | 7.018896 | 0.000162 | 0.222118 | 0.101504 |
| deque | 0.000901 | 0.000897 | 0.021794 | 0.019965 | 0.000303 | 0.151282 | 0.301467 |
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 <vector> | |
| #include <cmath> | |
| #include <SFML/Graphics.hpp> | |
| #include "roundendedline.hpp" | |
| int main() { | |
| sf::Vector2f cross[][2] = { |