Skip to content

Instantly share code, notes, and snippets.

View Angelmmiguel's full-sized avatar

Ángel M Angelmmiguel

View GitHub Profile
@bomberstudios
bomberstudios / svgo-sketch.sh
Created April 16, 2015 14:07
SVGo options to clean up Sketch's SVG files without destroying them
svgo --pretty --enable=removeTitle --enable=removeDesc --enable=removeDoctype --enable=removeEmptyAttrs --enable=removeUnknownsAndDefaults --enable=removeUnusedNS --enable=removeEditorsNSData -f folder_with_svg_files
@sparkprime
sparkprime / main.jsonnet
Last active March 15, 2021 06:43
Example of string templating within Jsonnet
{
template: (importstr "template.yaml") % {
name: "rabbitmq",
image: "whatever",
cookie: "XXXX",
data_volume: std.toString({ name: "thing", foo: [1, 2, 3] }),
nodes: std.toString(['rabbit@rabbitmq-%s' % shard_name for shard_name in [1, 2, 3]]),
},
}
# sets the proxy cache path location, max size 2g
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
@jefftrull
jefftrull / main.cpp
Created October 22, 2011 02:00
Example of embedding Ruby interpreter into C/C++ program
// very basic embedded Ruby interpreter for C++ programs
// thrown together by Jeff Trull <jetrull@sbcglobal.net> based on googling and asking questions on #ruby-lang
#include <ruby.h>
// access to C variables
static VALUE getter(VALUE ns, VALUE var) {
return Qfalse;
}
VALUE setter(VALUE ns, VALUE var, VALUE val) {
@denmarkin
denmarkin / resque.rake
Created September 20, 2011 11:02
My rake task for clearing Resque queues and stats
# see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version
# see https://github.com/defunkt/resque/issues/49
# see http://redis.io/commands - new commands
namespace :resque do
desc "Clear pending tasks"
task :clear => :environment do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."
@cameronblandford
cameronblandford / knexPostgresFullTextSearch.js
Last active November 8, 2023 07:35
Implement full text search using Knex + Objection
// Because we're using an ORM (Objection), it's a pain to add a tsvector when inserting,
// since tsvectors and FTS aren't supported by Objection. Instead, I've added a hook that
// fires on insert which auto-generates the tsvector field for each newly inserted entry.
// This is an example knex migration file for said behavior.
const addUserIndex = `
ALTER TABLE public.user ADD "document" tsvector;
CREATE FUNCTION my_trigger_function()
RETURNS trigger AS $$

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@Remiii
Remiii / README.md
Last active March 6, 2024 19:52
How to delete Vault (AWS Glacier) 🗻

How to delete Vault (AWS Glacier)

This Gist give some tips in order to remove AWS Glacier Vault with AWS CLI (ie. https://aws.amazon.com/en/cli/).

Step 1 / Retrive inventory

$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --vault-name YOUR_VAULT_NAME --account-id YOUR_ACCOUNT_ID --region YOUR_REGION
@ghosh
ghosh / micromodal.css
Last active March 21, 2024 16:12
Demo modal styles for micromodal.js and corresponding expected html. If using this, set the `awaitCloseAnimation` in config to true
/**************************\
Basic Modal Styles
\**************************/
.modal {
font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
}
.modal__overlay {
position: fixed;
@gauravtiwari
gauravtiwari / window-auth-popup.es6.js
Last active April 12, 2024 00:56
Promise based popup window for server oAuth
/* global window */
const popup = (url) => {
const windowArea = {
width: Math.floor(window.outerWidth * 0.8),
height: Math.floor(window.outerHeight * 0.5),
};
if (windowArea.width < 1000) { windowArea.width = 1000; }
if (windowArea.height < 630) { windowArea.height = 630; }