Skip to content

Instantly share code, notes, and snippets.

View andreymeretsky's full-sized avatar

Andrey Meretsky andreymeretsky

  • Odessa, Ukraine
View GitHub Profile
@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active May 23, 2024 07:53
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@hotmeteor
hotmeteor / generate_timezone_list.php
Last active February 12, 2023 23:03
[PHP] Generate a timezone list with optgroups
/**
* Inspired by http://stackoverflow.com/questions/1727077/generating-a-drop-down-list-of-timezones-with-php
* @return array
*/
function generate_timezone_list()
{
static $regions = [
'Africa' => DateTimeZone::AFRICA,
'Americas' => DateTimeZone::AMERICA,
@shibli049
shibli049 / mysqldb_python3.sh
Last active April 23, 2023 05:48
Install mysqlclient for python3
#sudo pip3 install mysqlclient fails with mysql_config not found
sudo apt-get install libmysqlclient-dev
#without pip3 it will not going to work for python3
sudo pip3 install mysqlclient
# to run django migration
python3 manage.py migrate
@notFloran
notFloran / php-amqp.sh
Last active March 26, 2016 21:00
Install amqp extension for php - Debian 7
#!/bin/sh
apt-get install php5-dev make cmake php-pear
git clone git://github.com/alanxz/rabbitmq-c.git && cd rabbitmq-c
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
cmake --build . --target install
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 13, 2024 05:29
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@leek
leek / gist:1942116
Created February 29, 2012 16:19
INSERT ... ON DUPLICATE KEY UPDATE with Zend Framework (Zend_Db_Table))
<?php

/**
 * @method DbTable_Row_Foo createRow()
 */
class DbTable_Foo extends Zend_Db_Table_Abstract
{
    protected $_primary  = 'foo_id';
    protected $_name     = 'foo';
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@myano
myano / cs.py
Created June 30, 2011 01:25
Quick example of ncurses in Python!
#!/usr/bin/env python
import curses
import curses.textpad
import time
stdscr = curses.initscr()
#curses.noecho()
#curses.echo()