Skip to content

Instantly share code, notes, and snippets.

View jmazzi's full-sized avatar

Justin Mazzi jmazzi

View GitHub Profile
@xen0bit
xen0bit / Dockerfile
Created October 11, 2023 04:19
CVE-2023-38545
FROM debian:latest
RUN apt-get update && apt-get install -y \
git \
build-essential \
wget \
python3
WORKDIR /build
# This should be triggered through a cron job at 6:15 PM on week days.
# Example cron: 15 18 * * 1,2,3,4,5 cd ~/code/jury_duty && ~/.rbenv/shims/ruby call.rb >> ~/code/jury_duty/call-log.txt 2>&1
# It uses Twilio to make a call based on TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_PHONE.
# It calls the JURY_PHONE, transcribes it, looks for JURER_NUMBER and texts the result to PERSONAL_PHONE.
require "rubygems"
require "bundler/setup"
Bundler.require(:default)
Dotenv.load
@kepano
kepano / obsidian-web-clipper.js
Last active May 10, 2024 01:34
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@danielbachhuber
danielbachhuber / import-cache.php
Created March 31, 2016 18:27
During `wp import`, cache remote files locally for subsequent imports
<?php
/**
* Run with `wp --require=import-cache.php import ...
*/
WP_CLI::add_hook( 'after_wp_load', function(){
// Only intercept HTTP requests when the importer is running
if ( ! defined( 'WP_IMPORTING') || ! WP_IMPORTING ) {
return;
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }

Displaying images in the terminal with tput and echo

output

Requires ImageMagick, easily available from your favorite package manager. Tested on Linux and OSX
convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n "  ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash
@itspriddle
itspriddle / gist:4698767
Created February 2, 2013 18:48
This is why you shouldn't use floating points for money in your app
~ > node -e "console.log((0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3))"
false
~ > php -r "var_dump((0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3));"
bool(false)
~ > ruby -e "p (0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3)"
false
~ > python -c "print (0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3)"
@mtigas
mtigas / README.md
Last active December 16, 2022 02:12
this is the nginx config for https://mike.tig.as/, with config to avoid the BEAST exploit (by using TLS 1.2+ ciphers or RC4) and enable SSL perfect forward secrecy (by preferring ECDHE ciphers)

[mike.tig.as][mta] server configuration

This gist contains the nginx and tor configurations for the [mike.tig.as][mta] servers, mainly to show:

  • Use of the chris-lea/nginx-devel PPA to allow use of SPDY.
  • ssl_ciphers selection to mitigate BEAST attack, enable [perfect forward secrecy][pfs] if possible and select the strongest possible ciphers within those bounds. (Exception is made for several ciphers at the end of list, for compatibility reasons.)
@goosetav
goosetav / howto.md
Created November 1, 2012 21:01
prevent ttf fonts while running poltergeist

RE: teampoltergeist/poltergeist#44

Use Rack::SimpleEndpoint to prevent Poltergeist/PhantomJS from crashing on TTF fonts.

In config/environments/test.rb, add

require 'rack/contrib/simple_endpoint'
config.middleware.insert_after Rack::Runtime, Rack::SimpleEndpoint, /\.ttf$/ do |req, res, match|
  res.status = '403'

"I will not serve TTF fonts in test mode."

guake-helix() {
# HelixCore
guake --rename-tab="CoreSpec" --execute-command="cd /home/fabio/dev/site5/helix_core && bundle exec guard" &&
guake --new-tab=2 --rename-tab="Core" --execute-command="cd /home/fabio/dev/site5/helix_core" &&
# Helix
guake --new-tab=3 --rename-tab="HelixServer" --execute-command="cd /home/fabio/dev/site5/helix && rails s" &&
guake --new-tab=4 --rename-tab="HelixSpec" --execute-command="cd /home/fabio/dev/site5/helix && bundle exec guard" &&
guake --new-tab=5 --rename-tab="Helix" --execute-command="cd /home/fabio/dev/site5/helix";
}