Skip to content

Instantly share code, notes, and snippets.

@1v
1v / gist:b9039239c7cad9abf6a20260238e80f2
Created June 11, 2016 17:32
[Rails] Koala get "never expire" page access token
@oauth = Koala::Facebook::OAuth.new(<app_id>, <app_secret>, 'https://site.com/')
code = @oauth.url_for_oauth_code(:permissions => "publish_actions,manage_pages,publish_pages")
=> "https://www.facebook.com/dialog/oauth?client_id=<app_id>&redirect_uri=https%3A%2F%2Fsite.com%2F&scope=publish_actions%2Cmanage_pages%2Cpublish_pages"

Open that url in browser and grant access to app. At the end you will be redirected to your website https://site.com/?code=<access_token>. Paste access token here:

@oauth.get_access_token_info(<access_token>)

Paste that access token here:

@1v
1v / gist:df1e335888dc62661c02
Last active June 6, 2017 01:31
Redis and Resque for Ruby on Rails
  • Install Redis:
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
make install
@1v
1v / resque.rake
Last active April 4, 2016 05:07 — forked from andruby/deploy.rb
Start and Stop tasks for resque workers, with capistrano deploy hook (without God)
require 'resque/tasks'
require 'resque/scheduler/tasks'
def get_pgid(file)
pgid = true
if File.file?(file)
fpid = File.read(file).to_i
pgid = `ps -o pgid --no-headers --pid #{fpid}`.strip!
if pgid
puts "Process group ID found: #{pgid}"
@1v
1v / gist:d69671b8aa5383479648
Last active October 6, 2022 22:09
Installing Adminer on Ubuntu and integrating to ISPmanager
sudo su
mkdir /usr/share/adminer
cd /usr/share/adminer
wget "https://www.adminer.org/latest.php"
ln -s latest.php adminer.php
echo "Alias /random_string_here_for_ex_vsj935j43s /usr/share/adminer/adminer.php" > /etc/apache2/conf-available/adminer.conf
a2enconf adminer
service apache2 restart
exit
@1v
1v / downgrade.sh
Last active January 31, 2018 13:09 — forked from reagent/downgrade.sh
Apache 2.2.22 + PHP 5.3.10 on Ubuntu 14.04
cat <<EOF >> /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu precise main restricted universe
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
EOF
apt-get update
apt-get remove \
apache2 \
wget http://nmap.org/dist/nmap-6.40.tar.bz2
tar -jxvf nmap-6.40.tar.bz2
cd nmap-6.40
./configure
make "LUA_LIBS=../liblua/liblua.a -ldl -lm"
sudo checkinstall
sudo dpkg -i nmap_6.40-1_amd64.deb

ubuntuforums.org

@1v
1v / gist:a2a324e4205ead51ae93
Created October 12, 2014 01:27
s3cmd download is slow

Here’s a tip to fix it: the s3cmd upload/download speed can be tuned by modifying send_chunk/recv_chunk variables in the s3cfg configuration file (the default is 4096 – 4KB). source

@1v
1v / gist:e7099bc9321cac0d9aeb
Last active November 9, 2015 23:21
How to use bash "screen"

How to use bash "screen"

Install:

apt-get install screen

Open first screen:

screen

Detach screen:

@1v
1v / gist:1633180ce64af07e23d0
Last active August 29, 2015 14:04 — forked from anonymous/gist:107dc04a9d9199db1117
How to turn off ads in µTorrent

Options>preferences>Advanced...

Turn all these settings to false:

left_rail_offer
gui.show_plus_upsell
sponsored_torrent_offer_enabled
bt.enable_pulse
gui.show_notorrents_node
offers.content_offer_autoexec
@1v
1v / gist:04901ed17202cddfe42d
Last active November 12, 2020 20:49
God and Puma configuration

God and Puma configuration

Add to Gemfile:

gem 'puma'
gem 'god'

Run in app folder:

bundle install