Skip to content

Instantly share code, notes, and snippets.

View dergachev's full-sized avatar

Alex Dergachev dergachev

View GitHub Profile
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index b381fbc..b4a4aad 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -132,7 +132,7 @@ class MyController < ApplicationController
@user = User.current
layout = @user.pref[:my_page_layout] || {}
# remove if already present in a group
- %w(top left right).each {|f| (layout[f] ||= []).delete block }
+ %w(top left right bottom).each {|f| (layout[f] ||= []).delete block }

Je veux seulement développer des logiciels propriétaires car cela m'est égal si la toile mondiale est ruinée.

Je veux toujours rester fidèle à Linux bien qu'on me force la main à développer en Windows.

À mes yeux, un bon développeur ne gaspille pas de temps pour rédiger des guides pratiques ou créer les essais d'un programme pourvu qu'on utilise un système pour gérer toutes les versions des ensembles de données.

Je cherche un logiciel pour acquérir la connaissance du français de crainte que je sois dénoncé comme espion russe.

Je peux me croiser les bras pendant que mes créations se promeuvent elles-mêmes.

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'
@dergachev
dergachev / Vagrantfile.docker
Created October 1, 2014 12:16
Vagrantfile for docker
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "trusty64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
====================
Test name: test with tilde, should print NULL
====================
INPUT:
---
1: a
2: ~
@dergachev
dergachev / ubuntu-eol.md
Last active December 7, 2023 22:26
What to do when your ubuntu distro is End-of-Life

Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.

You'll probably figure this out the hard way. When you run sudo apt-get update, it will eventually report these errors:

Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
  404  Not Found [IP: 91.189.91.15 80]
@dergachev
dergachev / docker.mk
Last active September 19, 2017 09:14
Useful Makefile snippets for docker usage
name=coursecal-d7
port=$(shell docker inspect -format='{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}' $(name))
# launches a debug shell into the latest intermediate docker image
debug_latest:
docker run -t -i `docker images -q | head -n 1` /bin/bash
# DESTROYS all containers (!!) and all images without a tag
# NB:
@dergachev
dergachev / Makefile
Created July 3, 2014 16:58
google-translation-experimentation
working:
@echo "WORKING"
time curl 'https://translate.google.com/translate_a/single?client=t&sl=fr&tl=en&hl=en&dt=bd&dt=ex&dt=ld&dt=md&dt=qc&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&oc=1&prev=conf&psl=auto&ptl=en&otf=1&it=sel.7964&ssel=3&tsel=0&q=contravention' \
-H 'pragma: no-cache' -H 'accept-encoding: gzip,deflate,sdch' -H 'accept-language: en-US,en;q=0.8,fr;q=0.6' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36' -H 'x-chrome-uma-enabled: 1' -H 'accept: */*' -H 'cache-control: no-cache' \
-H 'referer: https://translate.google.com/' \
-H 'x-client-data: CMy1yQEIlLbJAQiltskBCKm2yQEIxLbJAQi4iMoBCOmIygEIqZTKAQ==' \
--compressed \
| jq '.'
query=contravention
chrome.webRequest.onHeadersReceived.addListener(
function (details) {
for (var i = 0; i < details.responseHeaders.length; ++i) {
if (details.responseHeaders[i].name.toLowerCase() == 'x-frame-options') {
details.responseHeaders.splice(i, 1);
return {
responseHeaders: details.responseHeaders
};
}
}
wget http://downloads.sourceforge.net/gparted/gparted-live-0.18.0-1-i486.iso
# got path from VBox GUI
cd '/Users/dergachev/VirtualBox VMs/docker-vm_default_1389213567886_15275'
VBoxManage clonehd box-disk1.vmdk cloned.vdi --format vdi
VBoxManage modifyhd cloned.vdi --resize 102400
VBoxManage clonehd "cloned.vdi" box-disk1-100gb.vmdk --format vmdk
# go to VBox GUI and attach box-disk1-100gb.vmdk in storage section
# also create new IDE controller, and then add gparted.iso as image (need to create blank one first, UI was buggy)