Skip to content

Instantly share code, notes, and snippets.

:root {
--uc-bg-color: #1a1e26;
--uc-show-new-tab-button: none;
--uc-show-tab-separators: none;
--uc-tab-separators-color: none;
--uc-tab-separators-width: none;
--uc-tab-fg-color: #fff;
}
#titlebar {
@RoxasShadow
RoxasShadow / ping_read_write_localstack_s3.sh
Created June 3, 2020 10:10
Try pinging Localstack and then reading and writing a file to/from a bucket on (Localstack or AWS) S3
#!/bin/bash
PORT=4572
# Ping Localstack up to 10 times every 0.5s.
# Using docker-wait wouldn't work as the server
# runs as blocking process and never terminates.
echo "Waiting for Localstack to be up..."
while ! nc -z localhost $PORT; do
sleep 0.5
@RoxasShadow
RoxasShadow / chartjs_hovercrosslines.js
Created October 26, 2019 14:16
Draw cross lines when hovering on a Chart.js graph.
Chart.defaults.LineWithLine = Chart.defaults.line;
Chart.controllers.LineWithLine = Chart.controllers.line.extend({
draw: function(ease) {
Chart.controllers.line.prototype.draw.call(this, ease);
if (this.chart.tooltip._active && this.chart.tooltip._active.length) {
var activePoint = this.chart.tooltip._active[0],
ctx = this.chart.ctx,
x = activePoint.tooltipPosition().x,
y = activePoint.tooltipPosition().y,
@RoxasShadow
RoxasShadow / file-browser-as-a-gallery.js
Last active February 7, 2019 12:53
Userscript to redesign the file browser as a gallery. Made in a few minutes, the code is bad and intended to just work. Example: https://i.imgur.com/UZZFZqq.jpg
@RoxasShadow
RoxasShadow / png2txt.rb
Last active February 14, 2018 00:46
Use imagemagik and Capture2Text to perform OCR
im = "C:\\Program Files\\ImageMagick-7.0.7-Q16\\magick.exe"
c2t = "H:\\Users\\Giovanni\\Downloads\\Capture2Text_v4.5.1_64bit\\Capture2Text_CLI.exe"
Dir.mkdir('res') unless Dir.exists?('res')
require 'thread/pool'
pool = Thread.pool(8)
Dir['*.png'].each do |f|
pool.process {
pragma solidity ^0.4.19;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
puzzle = <<-EOF
5 1 9 5
7 5 3
2 4 6 8
EOF
puzzle.lines.map { |l| l.split.map(&:to_i).minmax.inject(:-).abs }.inject(:+)
contract Day2 {
uint constant SPACE = 32;
uint constant NEW_LINE = 10;
bytes public b;
uint[] public stack;
function Day2() public {
string memory puzzle = "5 1 9 5\n7 5 3\n2 4 6 8";
b = bytes(puzzle);
contract Day2 {
uint constant SPACE = 32;
uint constant NEW_LINE = 10;
bytes public b;
uint[] public stack;
function Day2() public {
string memory puzzle = "5 1 9 5\n7 5 3\n2 4 6 8";
b = bytes(puzzle);
@RoxasShadow
RoxasShadow / twitter_hq_images.js
Last active April 15, 2018 00:40
replace all the images with their HQ version (that is, the one that's been uploaded originally)
// ==UserScript==
// @name Twitter HQ images
// @namespace https://gist.github.com/RoxasShadow/031eda7f62d09bc8d61d1d5739038329
// @description Replace all the images with their HQ version
// @include https://twitter.com/*
// @author Roxas Shadow
// @version 1
// @grant none
// @run-at document-idle
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js