Skip to content

Instantly share code, notes, and snippets.

View haltaction's full-sized avatar
👻

Vladimir haltaction

👻
  • Ukraine, Cherkasy
View GitHub Profile
@haltaction
haltaction / SearchService
Last active February 4, 2016 16:41
Symfony mongo search service
<?php
namespace CoreBundle\Service;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Query\Query;
class SearchService
{
private $dm;
@haltaction
haltaction / script.js
Last active February 28, 2016 19:09
fs.to jq-selectors for remove static ads
$('#contentInner > div[class^=b-]').remove();
$('.l-tab-item-content > div[class^=b-] > div:first').remove();
$('.l-content .b-nowviewed').prev().prev().remove();
$('.b-section-list > div[class^=b-]').not('.b-pager__wrap').remove();
@haltaction
haltaction / build_mysql51.sh
Created March 3, 2016 19:37 — forked from kamermans/build_mysql51.sh
Build MySQL 5.1 on Ubuntu 12.04 and later (5.1 is not available in Ubuntu repo)
#!/bin/bash
set -e
cd ~/
wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.72.tar.gz
tar -zxf mysql-5.1.72.tar.gz
cd mysql-5.1.72
./configure '--prefix=/usr' '--exec-prefix=/usr' '--libexecdir=/usr/sbin' '--datadir=/usr/share' '--localstatedir=/var/lib/mysql' '--includedir=/usr/include' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-system-type=debian-linux-gnu' '--enable-shared' '--enable-static' '--enable-thread-safe-client' '--enable-assembler' '--enable-local-infile' '--with-fast-mutexes' '--with-big-tables' '--with-unix-socket-path=/var/run/mysqld/mysqld.sock' '--with-mysqld-user=mysql' '--with-libwrap' '--without-readline' '--with-ssl' '--without-docs' '--with-extra-charsets=all' '--with-plugins=max' '--with-embedded-server' '--with-embedded-privilege-control'
make
  1. Design the object model for a currency conversion library. Assume you're working for a bank which allows its clients to deposit money into their USD account. Customers have cash in different currencies and want to know the amount in USD which will be added to their account. You want to create a library for a widget which calculates the resulting amount in USD.
    UI looks like this:
[Currency name] [Amount] 
[Currency name] [Amount] 
[+] 
… 
[Resulting amount in USD] 
https://github.com/goq/telegram-list
// all inputs
xinput --list --short
// property of secected by id=10
xinput --list-props "Logitech USB Receiver"
// set sensitivity
xinput set-prop 10 "Device Accel Constant Deceleration" 1.5
// 0 - synchronios call
function runSync() {
const end = Date.now() + 3000;
while (Date.now() < end) {
const doSomethingHeavyInJavaScript = Math.random;
}
return 'task done';
}
@haltaction
haltaction / applications
Last active November 24, 2020 16:43
ubuntu tips
ubuntu - apps
- Glipper, ClipIt - clipboard manager
- indicator-sensors - shows temperature in tray
- fusuma - customize touchpad gestues
old
-Arc-darker - theme
-hdajackretask - rewrite jack outputs on soundcard
-screencloud
- battary info
upower -i $(upower -e | grep 'BAT')
- restart audio
pulseaudio -k && sudo alsa force-reload
- search string in directory
grep -rnw '/path/to/somewhere/' -e 'pattern'
------------
@haltaction
haltaction / gist:7a12647ae6db6593a4f7
Last active March 14, 2021 18:56
Linux translate text in buffer
1 - Устанавливаем обёртку над гугл транслейт
https://github.com/soimort/translate-shell
2 - Устанавливаем необходимые пакеты:
sudo apt-get install libnotify-bin xsel
3 - Создаём файл с именем sel-transl и копируем в него
#!/usr/bin/env bash
notify-send -u critical "$(xsel -o)" "$(xsel -o | trans -no-ansi -b :ru)"