Skip to content

Instantly share code, notes, and snippets.

View dergachev's full-sized avatar

Alex Dergachev dergachev

View GitHub Profile
@levelsio
levelsio / btc-eth-dca-buy.php
Last active October 20, 2024 21:22
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
<?
//
// [ BUY BTC & ETH DAILY ON BITSTAMP ]
// by @levelsio
//
// 2017-08-23
//
// 1) buy $40/day BTC
// 2) buy $10/day ETH
//

After running homesick clone dotfiles ...

E492: Not an editor command: Plugin 'gmarik/Vundle.vim'
line   96:
E492: Not an editor command: Plugin 'gmarik/vundle'
line   97:
E492: Not an editor command: Plugin 'kana/vim-fakeclip'
line   98:
E492: Not an editor command: Plugin 'jtratner/vim-flavored-markdown'
@RichardBronosky
RichardBronosky / multiple_ssh_setting.md
Last active June 5, 2024 19:16 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@amirkdv
amirkdv / mechanic.rb
Last active August 29, 2015 14:02
Login, click through, and get the data you need from an HTTPS site
#!/usr/bin/env ruby
# Use Mechanize to automatically login, click through, and fetch the data you
# need from an HTTPS site. The following works for the McGill admission portal.
# ruby mechanic.rb
# # Ready for Review
# # Ready for Review
require 'rubygems'
require 'mechanize'
@otobrglez
otobrglez / jaccard_recommendation.rb
Last active April 2, 2024 17:51
Simple recommendation system written in Ruby based on Jaccard index.
# Simple Recommendation Engine in Ruby
# Visit: http://otobrglez.opalab.com
# Author: Oto Brglez <[email protected]>
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end

When debugging Drupal, I often stick dpm($some_array, "my array"); calls to see what the value of $some_array is. This fails spectacularly if the code I'm debugging is run very late in the request after drupal_get_messages() has already been called. (Eg most hook_preprocess_THEMEHOOK functions).

In that case, I've found it useful to add these helper functions somewhere (any enabled custom module, or even index.php), use them instead of dpm. They'll serialize objects to apache's error_log (wherever that is), which you can track by opening a terminal tab and running:

tail -f /var/log/apache2/error.log | tr '%' "\n"
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 28, 2024 10:59
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@frenchesco
frenchesco / backtick-edit-page.md
Last active October 25, 2018 09:27 — forked from JoelBesada/README.md
A backtick command to make a page editable

This is a command for Backtick. It allows you to make a web page editable. Once you run the command you can click anywhere on the page and delete elements or type something.

To use this:

  1. Download Backtick.
  2. Copy the following ID of this Gist 7556270.
  3. Paste the ID into the custom commands field in the Backtick settings. You can easily access the settings by clicking the Backtick icon on the command execution console.
@cesarmiquel
cesarmiquel / README.md
Last active December 27, 2015 20:39 — forked from JoelBesada/README.md
Make Drupal issue queue information box sticky
@mijoharas
mijoharas / README.md
Last active December 27, 2015 16:09 — forked from JoelBesada/README.md
Backtick command for is it down.

This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

  3. Add some metadata to the command.json file:

  • name: The name of the command.