Skip to content

Instantly share code, notes, and snippets.

@rluvaton
rluvaton / Dockerfile
Created June 22, 2022 14:24
Elastic Search v6 with ARM support
FROM ubuntu:bionic-20220531
# Must be root to install the packages
USER root
# Install required deps
RUN apt update
RUN apt -y install gnupg wget apt-transport-https coreutils java-common
# Import Elasticsearch GPG Key
@GetVladimir
GetVladimir / Force-RGB-Color-on-M1-Mac.md
Last active April 26, 2024 08:54
Force RGB Color on M1 Mac

Force RGB Color on M1 Mac

How to Force RGB Color Output instead of YPbPr on your M1 Apple Silicon Mac for an External Monitor.

This step-by-step video tutorial will guide you through the procedure of forcing RGB color output on your M1 Mac.

Force RGB Color on M1 Mac

Here is the direct link to the video tutorial: https://www.youtube.com/watch?v=Z1EqH3fd0V4

The video also has Closed Captions (Subtitles) that you can enable, to make it easier to follow if needed.

@itszero
itszero / index.tsx
Last active October 26, 2018 17:20
Attempt to recreate react-redux using hooks
import * as React from "react";
import { useContext, useEffect, useState } from "react";
import { render } from "react-dom";
import { applyMiddleware, bindActionCreators, createStore } from "redux";
import ReduxThunk from "redux-thunk";
import { createSelector, createStructuredSelector } from "reselect";
import { action, getType } from "typesafe-actions";
interface Post {
id: number;
#!/usr/bin/env ruby
require 'json'
def run_cmd(cmd)
puts cmd
unless ENV['VERBOSE']
cmd = "#{cmd} > /dev/null"
end
system(cmd)
@dennisschaaf
dennisschaaf / A tool for Renaming fonts to solve Multiple font-face rules issue with wkhtmltopdf.md
Last active August 17, 2021 22:42
Renaming fonts to solve Multiple @font-face rules issue with wkhtmltopdf

The Problem

wkhtmltopdf is broken and cannot render multiple fonts because of some issues around names. See wkhtmltopdf/wkhtmltopdf#2435

Workaround

  1. Pick an 8 or less char name for each font and variation e.g. HelvBold, HelvLite, TimeReg
  2. Every variation needs to be a separate font file, with all the details renamed in Font Forge using the short name determined before.
  3. Give the font files the same short name (e.g. HelvBold.ttf)
@julianxhokaxhiu
julianxhokaxhiu / create-iso.sh
Created September 24, 2016 21:46
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@heyimalex
heyimalex / Selectize.jsx
Created August 15, 2014 17:30
React wrapper around Selectize.js
/** @jsx React.DOM */
// Wrapper around the selectize jQuery plugin.
module.exports = React.createClass({
getDefaultProps: function() {
return {
// HTML attrs
disabled: false,
multiple: false,
# Copied from http://ttaportal.org/wp-content/uploads/2012/10/7-Reallocation-using-LVM.pdf
##
## Showing the problem: need to reallocate 32GB from /dev/mapper/pve-data to /dev/mapper/pve-root
##
df -h
# Filesystem Size Used Avail Use% Mounted on
# /dev/mapper/pve-root 37G 37G 0 100% /
# tmpfs 2.0G 0 2.0G 0% /lib/init/rw
@BrettBukowski
BrettBukowski / gist:5347463
Last active December 29, 2023 06:48
Filter emails in Mail.app with regular expressions
-- Mail.app can't run a "Contains" filter with a regex,
-- so you can't filter on HTML content. Until now.
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
try
repeat with theMessage in theMessages
-- Getting the content as string converts all HTML tags to '?' and just leaves text content
set theBody to quoted form of (theMessage's content as string)
-- It's awkwardly hard to get sed to work w/ mult. lines, so collapse newlines
set theCommandString to "echo " & theBody & " | tr '\\n' ' ' | sed \"s/brett Author/*MATCHED*(&)/\"" as string