Skip to content

Instantly share code, notes, and snippets.

View ololobus's full-sized avatar
👹

Alexey Kondratov ololobus

👹
View GitHub Profile
@presci
presci / GrabUrl2.py
Created May 11, 2012 18:34
Semaphore example in python 2
import threading
import urllib2
import time, random
class GrabUrl(threading.Thread):
def __init__(self, arg0):
threading.Thread.__init__(self)
self.host=arg0
def run(self):
k=random.randint(10,20)
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jonasschneider
jonasschneider / foreman
Created February 2, 2013 21:13
foreman-systemd
#! /usr/bin/env ruby
require 'foreman/cli'
require File.expand_path(File.dirname(__FILE__)) + '/foreman_export_systemd.rb'
Foreman::CLI.start
@simonwhitaker
simonwhitaker / git-is-ancestor
Last active April 5, 2022 08:01
A script to determine whether one git commit is the ancestor of another
#!/bin/bash
#
# git-is-ancestor, by Simon Whitaker
#
# Suggested usage
#
# Store this file somewhere, make it executable, then alias
# it to git is-ancestor by putting this in your $HOME/.gitconfig:
#
# [alias]
@joost
joost / deploy.rb
Last active October 10, 2018 09:12 — forked from toobulkeh/deploy.rb
Capistrano 3 rails console tasks
# encoding: UTF-8
# Place in config/deploy.rb
# See: https://gist.github.com/joost/9343156
# Adapted to work with rbenv
namespace :rails do
desc "Open the rails console on primary app server"
task :console do
on roles(:app), primary: true do
rails_env = fetch(:stage)
execute_interactively "#{bundle_cmd} #{current_path}/script/rails console #{rails_env}"
@rtt
rtt / tinder-api-documentation.md
Last active May 5, 2024 15:28
Tinder API Documentation

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

@loderunner
loderunner / 01-mac-profiling.md
Last active June 8, 2024 09:44
Profiling an application in Mac OS X

Profiling an application in Mac OS X

Finding which process to profile

If your system is running slowly, perhaps a process is using too much CPU time and won't let other processes run smoothly. To find out which processes are taking up a lot of CPU time, you can use Apple's Activity Monitor.

The CPU pane shows how processes are affecting CPU (processor) activity:

@ikegami-yukino
ikegami-yukino / mac_word2vec_install.sh
Last active May 28, 2019 19:41
Install word2vec to Mac OS X later than 10.9
pushd . &> /dev/null
cd /tmp
git clone --depth=1 https://github.com/tmikolov/word2vec
cd word2vec
sed -i -e 's/malloc.h/stdlib.h/g' *.c
make
rm *.c* *.txt makefile LICENSE
cp * /usr/local/bin
popd &> /dev/null
@xrstf
xrstf / letsencrypt.md
Last active April 18, 2023 05:01
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@joepie91
joepie91 / vpn.md
Last active June 13, 2024 22:49
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.