Skip to content

Instantly share code, notes, and snippets.

Setting, DefaultValue, INIValue, CurrentValue, Origin
sScreenShotBaseName:Display, <unimplemented>, <unimplemented>, <unimplemented>, INI
sScreenShotFolderName:Display, <unimplemented>, <unimplemented>, <unimplemented>, INI
sRuntimeLODDatabasePath:LODManager, <unimplemented>, <unimplemented>, <unimplemented>, INI
strPluginsFileHeader:General, <unimplemented>, <unimplemented>, <unimplemented>, INI
sLanguage:General, <unimplemented>, <unimplemented>, <unimplemented>, INI
sFailureMessage:LANGUAGE, <unimplemented>, <unimplemented>, <unimplemented>, INI
sResourcePrefixList:Archive, <unimplemented>, <unimplemented>, <unimplemented>, INI
sDLCDefaultVoiceSuffix:Archive, <unimplemented>, <unimplemented>, <unimplemented>, INI
sLocalMasterPath:General, <unimplemented>, <unimplemented>, <unimplemented>, INI
Setting, DefaultValue, INIValue, CurrentValue, Origin
sScreenShotBaseName:Display, <unimplemented>, <unimplemented>, <unimplemented>, INI
sScreenShotFolderName:Display, <unimplemented>, <unimplemented>, <unimplemented>, INI
sRuntimeLODDatabasePath:LODManager, <unimplemented>, <unimplemented>, <unimplemented>, INI
strPluginsFileHeader:General, <unimplemented>, <unimplemented>, <unimplemented>, INI
sLanguage:General, <unimplemented>, <unimplemented>, <unimplemented>, INI
sFailureMessage:LANGUAGE, <unimplemented>, <unimplemented>, <unimplemented>, INI
sResourcePrefixList:Archive, <unimplemented>, <unimplemented>, <unimplemented>, INI
sDLCDefaultVoiceSuffix:Archive, <unimplemented>, <unimplemented>, <unimplemented>, INI
sLocalMasterPath:General, <unimplemented>, <unimplemented>, <unimplemented>, INI
@benpitman
benpitman / levenshtein.sh
Last active August 14, 2022 21:01
Bash function to calculate the levenshtein distance between two strings
#!/usr/bin/env bash
levenshtein ()
{
local -r -- target=$1
local -r -- given=$2
local -r -- targetLength=${#target}
local -r -- givenLength=${#given}
local -- alt
local -- cost
@Ocramius
Ocramius / Caddyfile
Last active March 11, 2024 22:14
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
:80 {
root /serve
}
@j1mc
j1mc / bulma-sass-scss.rb
Last active August 14, 2023 05:04 — forked from DanyHenriquez/bulma-sass-scss.rb
Convert bulma from sass to scss
#!/usr/bin/env ruby
require 'tmpdir'
require 'fileutils'
dir = Dir.tmpdir()
if File.directory?("#{dir}/bulma")
FileUtils.remove_dir("#{dir}/bulma")
end
# see: https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html
LOGLEVELS = %w[DEBUG INFO WARN ERROR FATAL UNKNOWN].freeze
LOGGER = Logger.new(STDOUT)
level ||= LOGLEVELS.index ENV.fetch("LOG_LEVEL","WARN") # default to WARN index: 2
level ||= Logger::WARN # FIX default in case of environment LOG_LEVEL value is present but not correct
LOGGER.level = level
# Usage:
# before launching the program:
# $ export LOG_LEVEL=DEBUG
@arpit
arpit / cryptokitties.sol
Created January 23, 2018 21:33
Cryptokitties Contract from the Eth blockchain
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
@waffleau
waffleau / extract_dominant_colors.rb
Last active March 27, 2024 10:22
Extract dominant colours from an image in Ruby using MiniMagick
def self.extract_dominant_colors(image_path, quantity=5, threshold=0.01)
image = MiniMagick::Image.open(image_path)
# Get image histogram
result = image.run_command('convert', image_path, '-format', '%c', '-colors', quantity, '-depth', 8, 'histogram:info:')
# Extract colors and frequencies from result
frequencies = result.scan(/([0-9]+)\:/).flatten.map { |m| m.to_f }
hex_values = result.scan(/(\#[0-9ABCDEF]{6,8})/).flatten
total_frequencies = frequencies.reduce(:+).to_f
@Koenvh1
Koenvh1 / streamtheworld-parser.php
Created January 14, 2017 16:57
Convert StreamTheWorld.com callsign to actual stream URL
<?php
/*
* Because the actual streaming URLs from StreamTheWorld.com stations change often,
* this script will dynamically redirect you to the stream URL.
*
* Do with it what you want :-)
* Koen (koenvh.nl)
*
* Usage: Provide a "sign" argument in your get request.
* This is the station's sign, which is the part after the slash without the (AAC)_SC part.
@rosenfeld
rosenfeld / thread-pool.rb
Created June 7, 2016 12:49
Simple thread pool implementation in Ruby
require 'thread' # for Mutex: Ruby doesn't provide out of the box thread-safe arrays
class ThreadPool
def initialize(max_threads = 10)
@pool = SizedQueue.new(max_threads)
max_threads.times{ @pool << 1 }
@mutex = Mutex.new
@running_threads = []
end