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
| require "file" | |
| require "telegram_bot" | |
| require "./definebot/*" | |
| TOKEN = File.read(File.join(__DIR__, "..", ".secret-token")) | |
| module Definebot | |
| class Bot < TelegramBot::Bot | |
| include TelegramBot::CmdHandler |
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
| require "json" | |
| module Types | |
| class Result | |
| JSON.mapping( | |
| metadata: ResultMetadata, | |
| results: Array(Word), | |
| ) | |
| end | |
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 json, strutils | |
| proc toQueryString*(json: JsonNode): string = | |
| if json == nil: return "" | |
| var parts: seq[string] = @[] | |
| for key, val in json: | |
| if val.kind != JNull: | |
| if val.kind == JString: | |
| parts.add(key & "=" & val.getStr().encodeUrl()) | |
| else: |
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 ruby | |
| require 'optparse' | |
| require 'fileutils' | |
| require 'mini_magick' | |
| require 'pp' | |
| options = { | |
| output: '.', | |
| format: '%n%-%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
| sudo pacman -S base-devel linux-headers | |
| git clone https://github.com/gnab/rtl8812au.git | |
| cd rtl8812au | |
| make | |
| sudo cp 8812au.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless | |
| sudo depmod -a |
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
| router.get("/", async (req, res) => { | |
| const texts = await TextBlock.find({}) | |
| const others = await otherModels.find({}) | |
| res.render("adminSite/intro", { texts, others }); | |
| }); |
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 std.stdio; | |
| import std.array : split; | |
| import vibe.core.net; | |
| import vibe.stream.tls; | |
| void main() | |
| { | |
| auto addr = "149.154.167.40:443"; | |
| auto addrParts = this.addr.split(":"); | |
| writeln(addrParts); |
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
| const KeyCodeMap = { | |
| backspace: 8, | |
| tab: 9, | |
| return: 13, | |
| left_arrow: 37, | |
| up_arrow: 38, | |
| right_arrow: 39, | |
| down_arrow: 40, | |
| insert: 45, | |
| delete: 46 |
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
| # Creates a `#==` method for a class or module. | |
| # Parameters: | |
| # args [Array(Tuple(Symbol, Symbol))] A list of properties to | |
| # use for comparison. The first will be for a method/variable | |
| # in the current class or module, the second will apply to the | |
| # other. | |
| # other_class [Class] The class to compare this one with | |
| # strict [Bool] Set to false to compare with parent classes too | |
| macro equalize(*args, other_class = nil, strict = true) | |
| {{ other_class = other_class ? other_class.id : @type.id }} |
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
| class MediaFinder | |
| alias FileInfo = NamedTuple(name: String, directory: String, size: UInt64) | |
| DEFAULT_MEDIA_TYPES = { | |
| images: ["jpg", "jpeg", "gif", "png", "exif", "tiff", "bmp"], | |
| videos: ["webm", "mkv", "flv", "vob", "ogv", "ogg", "gifv", "mng", "avi", "mts", "m2ts", "mov", "qt", "wmv", "mp4", "m4p", "mpg", "mpeg", "m4v", "3gp", "3g2"], | |
| audios: ["aa", "aac", "aax", "aiff", "flac", "m4a", "m4p", "mp3", "ogg", "sln", "wav", "wma"] | |
| } |