Skip to content

Instantly share code, notes, and snippets.

@ipepe
ipepe / smc-control.1s.rb
Created Aug 2, 2018
Cool but louder custom smc-controlled bitBar script
View smc-control.1s.rb
#!/usr/bin/env /Users/pptasinski/.rbenv/shims/ruby
MIN_TEMP = 40.0
MAX_TEMP = 70.0
FANS = {
0 => { min: 2200, max: 6100, delta: 6100-2200 },
1 => { min: 2100, max: 5600, delta: 5600-2100 }
}.freeze
temperature = `/usr/local/bin/smc -k TC0F -r`.match(/\d\d\.\d\d\d/).to_s.to_f
@ipepe
ipepe / function.js
Created Jun 27, 2018
Azure Function that responds with image (content type)
View function.js
module.exports = function (context, req) {
var image_str = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUTExMWFhUXGBkYFxgXGCAdIBkXGxoWGB8eGBseHiggGB8lHRgWITEjJSkrLi4uGB8zODMtNyotLisBCgoKDg0OFxAQGi4dHR8tLSstLS0tLS0rLS0tKy0tLS0tLS0tKy0tKy0tLSstLS0rLS0tLSstLTctLS0tLS03Lf/AABEIAOEA4QMBIgACEQEDEQH/xAAcAAEAAgMBAQEAAAAAAAAAAAAABQYDBAcCAQj/xAA+EAABAwIEBAQDBwMDAwUBAAABAAIRAyEEEjFBBQZRYRMicYEykaEHQrHB0eHwFFLxI2JyFTOiJENTksIW/8QAGAEBAQEBAQAAAAAAAAAAAAAAAAECAwT/xAAdEQEBAAIDAQEBAAAAAAAAAAAAAQIREiExUQNB/9oADAMBAAIRAxEAPwDqvHMU4HIKhpg7tALvYmwHstKhWrtgsxIqgTLazAJGsB7AMvaQVp85PiqP+IP4+y1uFY4PbBEj1/Zcva6zHpccDxBtS0Frxqx2o39CO4st1U19YiA4kQfJUDSTT99COrNFvs5oZTc1mJimXGGVAZpv0gh33SST5TcR7qzLXVYuPxY0WB+MY0SXNA6kjufyPyUJj+dsFSs/EMBmNfr6d1vbOliRUyn9p3DiJNcDaIJ/JZm/aNw8vDRXYZMZtvc7bJtdLaij+H8aoVgDTqNdImzhaVu+IOoVR6K1cXjmMIBkuOjWiSfYbdzZR2N463K7IfKCWmpFrRPh7PM2nQfRRWCrvqOJAe1nVzTL+5dqT22GixcvjUx+pn/qtWR/6d0b+dkj2DrqRwmID25h/g9xsqpjK8fCe42Vi4PUzMDv7gCYG/XvsrKWJBERaZEREBERAREQEREBERAREQEREFV57wmamHj7uvouZU+MPomPKRPlzE5R3IGq67zV/wBmMpdm
View adb-wifi.md

Why it's not written anywhere? Unauthorized USB device:

MBP-A1278-ipepe:~ patryk$ adb devices
List of devices attached
0b06b8360328c13a    unauthorized

Authorized USB device:

@ipepe
ipepe / dump_pg_database.sh
Created Dec 11, 2017
Dumping command for postgres database backup
View dump_pg_database.sh
pg_dump -d DATABASE_NAME -Fp | bzip2 > dbdump_`date +"%F-%H-%M-%S"`.sql.bz
@ipepe
ipepe / install-chrome-headless.sh
Last active Sep 11, 2022
Installing headless chrome on Ubuntu.
View install-chrome-headless.sh
#!/bin/bash
# from https://chromium.woolyss.com/
# and https://gist.github.com/addyosmani/5336747
# and https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:canonical-chromium-builds/stage
sudo apt-get update
sudo apt-get install chromium-browser
chromium-browser --headless --no-sandbox http://example.org/
View gist:ced607cbafc86339636dad7d37ca311e
https://github.com/lesaff/serverpilot-letsencrypt
https://serverpilot.io/community/articles/how-to-force-SSL-by-redirecting-http-to-https.html
@ipepe
ipepe / install_pg.sh
Last active Aug 23, 2017
Install pg gem when using Postgress.app on Mac
View install_pg.sh
#!/bin/bash
gem install pg -v '0.19.0' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
# or just add bin of Postgress app into PATH env
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
@ipepe
ipepe / rails_proficiency.txt
Last active Jan 2, 2019 — forked from romansklenar/rails_proficiency.txt
Proficiency requirements for Rails developer
View rails_proficiency.txt
Expert
Understands Ruby internals and is aware of multiple layers of software inner workings.
Senior (enterprise)
Analyse and profile an application for performance and memory issues
Analyses and profile an application for security issues
Understand database modeling and query analysis
Tune a production deployment (Passenger, Thin, Apache etc)
Understand and use Ruby metaprogramming
View redmine_on_pnpr.sh
#!/bin/bash
docker run -v ~/docker/redmine-pnpr/data:/data -p 4567:80 --restart=unless-stopped -d --name redmine ipepe/pnpr:v1
View sleep_in_sync.coffee
window.sleep = (time_in_miliseconds, callback)->
time = Date.now()+time_in_miliseconds
while(Date.now() < time)
Math.Pi/3.14
callback() if callback