This file contains 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
# Copyright (c) 2020 Raspberry Pi (Trading) Ltd. | |
# | |
# SPDX-License-Identifier: BSD-3-Clause | |
# Controls the crystal oscillator | |
module XOSC | |
VERSION = "1" | |
BASE_ADDRESS = 0x40024000_u64 | |
# Crystal Oscillator Control |
This file contains 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
// ==UserScript== | |
// @name Github Chronological Repo List | |
// @namespace https://gist.github.com/maxpowa/d3eb439b990fbee8cff2ae45d726c834 | |
// @description Bring back chronological repo list on the github home page | |
// @include https://github.com/ | |
// @version 0.0.2 | |
// @require https://openuserjs.org/src/libs/sizzle/GM_config.js | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// ==/UserScript== |
This file contains 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
.\vs_buildtools.exe --passive --norestart --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended | Out-Default | |
$script = @' | |
$installdir = "$pwd" | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
echo "Downloading cmake" | |
iwr https://cmake.org/files/v3.11/cmake-3.11.4-win64-x64.zip -OutFile cmake.zip | |
Expand-Archive cmake.zip -DestinationPath . |
This file contains 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 "spec" | |
require "json" | |
require "uuid" | |
require "uuid/json" | |
require "big/json" | |
module JSON | |
annotation SerializableAnnotation | |
end |
This file contains 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
def isLoggedIn(context, repo) | |
sessionId = context.session.string?("userId") | |
if sessionId | |
user = repo.findUserByUserId(sessionId) | |
case user | |
when DB::Success | |
groupId = user.value["activeChannel"].as_h.fetch("groupId", "") | |
channelId = user.value["activeChannel"].as_h.fetch("channelId", "") |
This file contains 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 Lisp | |
alias Value = Symbol | String | Int64 | Bool | Nil | Builtin | List | |
record Symbol, value : String | |
struct List | |
getter list : Array(Value) | |
def initialize(@list = Array(Value).new) | |
end |
This file contains 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 "big_decimal" | |
require "benchmark" | |
def new(str : String) : BigDecimal | |
reader = Char::Reader.new(str) | |
value = BigInt.new(0) | |
scale = 0_u64 | |
if reader.current_char == '-' | |
negative = true |
This file contains 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 "http" | |
require "radix" | |
class WebServer | |
alias Route = HTTP::Server::Context, Hash(String, String) -> Nil | |
def initialize(@config : Config, @db : DB::Database) | |
@tree = Radix::Tree(Route).new | |
draw_routes |
This file contains 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 MediaManager | |
class VideoFile | |
CHUNK_SIZE = 64 * 1024 | |
def self.compute_hash(file_path : String) | |
filesize = File.size(file_path) | |
hash = filesize | |
# Read 64 kbytes, divide up into 64 bits and add each | |
# to hash. Do for beginning and end of file. |
This file contains 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 "benchmark" | |
STATUS_CODE = "200" | |
METHOD = "GET" | |
PATH = "api/v1/users" | |
IO = MemoryIO.new(100) | |
Benchmark.ips do |x| | |
x.report "Normal String" do | |
IO << "|#{STATUS_CODE}| #{METHOD} #{PATH}" |
NewerOlder