Skip to content

Instantly share code, notes, and snippets.

View mysticaltech's full-sized avatar

K. N. mysticaltech

  • Spain
View GitHub Profile
@vitalyfriedman
vitalyfriedman / gist:5943304
Created July 7, 2013 12:24
Resizing JPEG images in a folder (two versions).
ls *.jpg|while read i;do convert $i -strip -interlace Plane -resize "500x" -unsharp 2x0.5+0.5+0 -quality 90 `basename $i .jpg`_small.jpg; convert $i -strip -interlace Plane -resize "1000x" -unsharp 2x0.5+0.5+0 -quality 90 `basename $i .jpg`_large.jpg; done
@philihp
philihp / nginx.conf
Last active December 5, 2017 23:28 — forked from sumardi/nginx.default.conf
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php56-fpm
# Install PHP extensions
sudo yum install -y php56-devel php56-mysql php56-pdo \
php56-pear php56-mbstring php56-cli php56-odbc \
@hectorperez
hectorperez / rvm cron setup
Created May 19, 2014 16:16
Requiring a Ruby Gem in Ruby Script breaks Cron Job Execution: rvm cron setup
You need to setup your crontab with rvm e.g:
rvm cron setup
With that rvm sets your environment variables in your crontab file
then you have a crontab file having this at the top:
PATH="/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/"
rvm_env_string='ruby-1.9.3-p194'
@JonTheWong
JonTheWong / ovh-centos7-hostname
Last active January 30, 2020 18:25
OVH - CentOS 7 - Change Hostname
I'm writting this gist for anyone who is having problems updating their OVH Public Cloud hostname on CentOS 7
The issue:
When ordering a public cloud instance and setting the instance name to sub.domain.tld and then eventually changing that sub
the settings don't seem to update on OVH side.
It looks like systemd-hostnamed still pulls the original hostname from what i'm guessing is the datastore on OpenStack. (unconfirmed)
The solution:
@uttara-cmu
uttara-cmu / sample_size_AB.R
Last active April 3, 2020 08:22
Evan Miller's Tool - R code
# The code given in #2 gist is not in R. There is a change in formula compared to the one in this blog post and the one used by Evan Miller's tool (#3). http://www.alfredo.motta.name/ab-testing-from-scratch/#easy-footnote-bottom-24-982
#1. https://stats.stackexchange.com/questions/357336/create-an-a-b-sample-size-calculator-using-evan-millers-post
#2. https://gist.github.com/mottalrd/7ddfd45d14bc7433dec2#file-gistfile1-txt
#3. https://www.evanmiller.org/ab-testing/sample-size.html
p = 0.03
pct_mde = 0.1
alpha = 0.05
power = 1- 0.2
@Cryptophobia
Cryptophobia / helm-setup.md
Last active April 23, 2020 17:16
Helm Init GKE RBAC Hephy Workflow

Running Hephy Workflow on GKE Kubernetes Cluster Fix:

There is a fix for Helm that we need to do if we are using Helm 2.x in order to give helm enough permissions to create releases.

Hopefully this will be fixed in Helm 3.x as promised.

This is a known issue and was first found here: helm/helm#3055

Before we deploy Hephy Workflow, we need to enable our user to be able to create RBAC roles since Hephy Workflow needs to configure its own clusterroles through Helm:

Prerequisites for using Helm on GKE Role-Based Access Control:

{
"type": "webpack",
"entryPoint": 1,
"knownPaths": {},
"moduleAst": ["body", 0, "expression", "argument", "arguments", 0]
}
@racitup
racitup / html_to_text.py
Last active July 29, 2021 09:43
Extract text from html in python using BeautifulSoup4
from bs4 import BeautifulSoup, NavigableString, Tag
def html_to_text(html):
"Creates a formatted text email message as a string from a rendered html template (page)"
soup = BeautifulSoup(html, 'html.parser')
# Ignore anything in head
body, text = soup.body, []
for element in body.descendants:
# We use type and not isinstance since comments, cdata, etc are subclasses that we don't want
if type(element) == NavigableString:
@marshki
marshki / mirror_mirror.sh
Last active December 3, 2021 20:35
One-way Rsync mirror of data from source to destination. Run as a crontab.
#!/usr/bin/env bash
#
# mirror_mirror
#
# One-way Rsync mirror of data from source to destination.
#
# Author: M. Krinitz <mjk235 [at] nyu [dot] edu>
# Date: 2020.04.20
# License: MIT
#
@andrekandore
andrekandore / gist:3140554
Created July 19, 2012 03:27 — forked from RiANOl/gist:1077760
AES128, AES256 encrypt/decrypt in Ruby
require "openssl"
require "digest"
def aes128_encrypt(key, data)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.update(data) + aes.final
end