Skip to content

Instantly share code, notes, and snippets.

@arcreative
arcreative / Dockerfile
Created February 3, 2023 19:38
SunPower PVS5/PVS6 Proxy to Home Assistant Scraper
FROM alpine:latest
RUN apk add --update --no-cache ruby -y
ADD scraper.rb .
CMD ["ruby", "scraper.rb"]
#!/usr/bin/sudo ruby
#
# revealer.rb -- Deobfuscate GHE .rb files.
#
# This is simple:
# Every obfuscated file in the GHE VM contains the following code:
#
# > require "ruby_concealer.so"
# > __ruby_concealer__ "..."
@arcreative
arcreative / polymorphic_include_failing_test_primitive_audits.rb
Last active September 25, 2019 23:46
A more basic version of polymorphic_include_failing_test.rb, but without the actual audited gem
begin
require 'bundler/inline'
require 'bundler'
rescue LoadError => e
STDERR.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true, ui: ENV['SILENT'] ? Bundler::UI::Silent.new : Bundler::UI::Shell.new) do
source 'https://rubygems.org'
@arcreative
arcreative / polymorphic_include_failing_test.rb
Last active September 25, 2019 23:34
JSONAPI::Resources failure when trying to include models on a polymorphic association
begin
require 'bundler/inline'
require 'bundler'
rescue LoadError => e
STDERR.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true, ui: ENV['SILENT'] ? Bundler::UI::Silent.new : Bundler::UI::Shell.new) do
source 'https://rubygems.org'
#!/bin/bash
if [ -z `which say` ]; then
echo Aww, no fun :-\(
exit 1
fi
while [ true ]; do
say never gonna give you up
say never gonna let you down
say never gonna run around and desert you
#!/bin/bash
sudo fallocate -l 2G /swapfile # <-- Don't forget to change size here
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo echo '/swapfile none swap sw 0 0' >> /etc/fstab
sudo sysctl vm.swappiness=10
sudo sysctl vm.vfs_cache_pressure=50
sudo echo 'vm.swappiness=10' >> /etc/sysctl.conf
require 'httparty'
class Plaid
class << self
def connect(username, password, institution, options = {})
# Login only unless otherwise specified
options[:login_only] ||= true
options[:webhook] ||= ENV['PLAID_WEBHOOK_URL'] if ENV['PLAID_WEBHOOK_URL']
import Ember from 'ember';
export default Ember.Mixin.create({
attributeBindings: ['data-original-title', 'data-toggle', 'data-placement'],
classNameBindings: ['hasError:has-warning'],
record: null,
property: null,
cacheBust: false,
/*
@arcreative
arcreative / svg.css
Last active December 14, 2015 20:48
Inline SVG styles
/* Make sure you set a dimension, or the SVG will attempt to fill all available space! */
svg {
width: 64px;
height: 64px;
}
/* all of our SVG images have a .svg-main class so we can change their base colors predictably */
svg .svg-main {
fill: white;
}
@arcreative
arcreative / Retina.js
Last active November 26, 2016 05:34
Simple retina src replacement
//Note: this example assumes jQuery is available on your site.
Retina = function() {
return {
init: function(){
//Get pixel ratio and perform retina replacement
//Optionally, you may also check a cookie to see if the user has opted out of (or in to) retina support
var pixelRatio = !!window.devicePixelRatio ? window.devicePixelRatio : 1;
if (pixelRatio > 1) {
$("img").each(function(idx, el){
el = $(el);