Skip to content

Instantly share code, notes, and snippets.

Michał Załęcki MichalZalecki

Block or report user

Report or block MichalZalecki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MichalZalecki
MichalZalecki / rails-gmail.rb
Last active Nov 8, 2019
Gmail configuration for Rails
View rails-gmail.rb
# /config/environments/development.rb
# Gmail configuration
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'example.com',
user_name: ENV['EMAIL_USER'],
@MichalZalecki
MichalZalecki / docx2pdf.py
Created Jul 8, 2017
Converting DOCX to PDF using Python
View docx2pdf.py
import sys
import subprocess
import re
def convert_to(folder, source, timeout=None):
args = [libreoffice_exec(), '--headless', '--convert-to', 'pdf', '--outdir', folder, source]
process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)
filename = re.search('-> (.*?) using filter', process.stdout.decode())
@MichalZalecki
MichalZalecki / Dockerfile
Last active Sep 12, 2019
Install oh-my-zsh in Docker
View Dockerfile
RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "zsh"]
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
# docker exec -it my-app-container /bin/zsh
View wtf.js
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2
View ContextCmder-Disable.reg
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@MichalZalecki
MichalZalecki / ensutils-rinkeby.js
Created May 3, 2018
ensutils to work with Rinkeby
View ensutils-rinkeby.js
// STOP!
// Are you thinking of using this in an app? Don't!
// This script is designed for interactive use in the go-ethereum console.
// For use in an app, consider one of these fine libraries:
// - https://www.npmjs.com/package/ethjs-ens
// - https://www.npmjs.com/package/ethereum-ens
function namehash(name) {
var node = '0x0000000000000000000000000000000000000000000000000000000000000000';
if (name !== '') {
@MichalZalecki
MichalZalecki / visor-archivos-online.md
Created Sep 5, 2016 — forked from izazueta/visor-archivos-online.md
Google Docs Viewer & Office Web Apps Viewer
View visor-archivos-online.md

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
@MichalZalecki
MichalZalecki / index.js
Created Mar 12, 2016
How to import RxJS 5
View index.js
// Import all
import Rx from "rxjs/Rx";
Rx.Observable
.interval(200)
.take(9)
.map(x => x + "!!!")
.bufferCount(2)
.subscribe(::console.log);
@MichalZalecki
MichalZalecki / await-async.js
Created Nov 13, 2015
Run generators and and await/async
View await-async.js
import axios from "axios";
export default async function () {
const { data: { id } } = await axios.get("//localhost:3000/id");
const { data: { group } } = await axios.get("//localhost:3000/group");
const { data: { name } } = await axios.get(`//localhost:3000/${group}/${id}`);
console.log(name); // Michał
}
@MichalZalecki
MichalZalecki / web3Events.js
Created Apr 8, 2018
MetaMask and web3 1.0
View web3Events.js
import Web3 from "web3";
const web3 = new Web3(Web3.givenProvider);
const web3Events = new Web3(new Web3.providers.WebsocketProvider("wss://mainnet.infura.io/ws"));
const Contract = new web3.eth.Contract(ABI, ADDRESS);
const ContractEvents = new web3Events.eth.Contract(ABI, ADDRESS);
You can’t perform that action at this time.