Skip to content

Instantly share code, notes, and snippets.

const PRICE_ZONE_1 = 30;
const PRICE_ZONE_2 = 50;
if(! TCT_ADDRESSES.every(a => a.postalCode)) {
return { transportation: 0, handling: 0,
error: "Merci de renseigner des adresses complètes comme 12 rue .."
};
};
@zimski
zimski / ocr.markdown
Created October 14, 2018 19:03 — forked from henrik/ocr.markdown
OCR on OS X with tesseract

Install ImageMagick for image conversion:

brew install imagemagick

Install tesseract for OCR:

brew install tesseract --all-languages

Or install without --all-languages and install them manually as needed.

@zimski
zimski / command-line-only-objectspace-trace.sh
Created February 16, 2018 17:30 — forked from schneems/command-line-only-objectspace-trace.sh
trace where Ruby objects come from with this handy bash 3 liner
echo 'require "objspace"; ObjectSpace.trace_object_allocations_start; Kernel.send(:define_method, :sup) do |obj| ; puts "#{ ObjectSpace.allocation_sourcefile(obj) }:#{ ObjectSpace.allocation_sourceline(obj) }"; end' > tmp/tmp-gemfile
cat Gemfile >> tmp/tmp-gemfile
cat tmp/tmp-gemfile > Gemfile
# $ bundle exec irb
# irb(main):001:0> require 'rails'
# => true
# irb(main):002:0> sup(Rails)
# /Users/richardschneeman/.gem/ruby/2.4.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:3
@zimski
zimski / debug_space.rb
Last active February 16, 2018 17:28
Object space Ruby debug
require 'objspace'
ObjectSpace.trace_object_allocations_start
Kernel.send(:define_method, :sup) do |obj|
puts "#{ ObjectSpace.allocation_sourcefile(obj) }:#{ ObjectSpace.allocation_sourceline(obj) }"
end
# sup some_thing

Keybase proof

I hereby claim:

  • I am zimski on github.
  • I am zimski (https://keybase.io/zimski) on keybase.
  • I have a public key ASBvRRXyO6PlsLEzKzE2KleRLPs6SedUD1zz7fg1_G_ZAgo

To claim this, I am signing this object:

#!/bin/bash
mkdir -p /tmp/sslInfo
rm -f /tmp/sslInfo/*
awk 'BEGIN {c=0;} /BEGIN CERT/{c++} { print > "/tmp/sslInfo/cert." c ".pem"}' < $1
for f in `ls /tmp/sslInfo`
do
echo "==========================================================="
openssl x509 -in /tmp/sslInfo/$f -text -noout | grep 'Subject\|Issuer'
cat /tmp/sslInfo/$f
echo "==========================================================="
@zimski
zimski / ocsp_generate_trusted_chain
Created January 16, 2015 16:15
Generate trusted chain for NGINX/APACHE
#!/bin/sh
#ocsp_prepare web_site_name crt_file root_ca result_trusted_chain
touch $4
cat $3 > $4
DOMAIN=$1
awk 'BEGIN {c=0;} /BEGIN CERT/{c++} { print > "cert." c ".pem"}' < $2
for f in cert.*.pem
do
echo "Processing: $f"
@zimski
zimski / tmux.md
Last active August 29, 2015 14:07 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},