Skip to content

Instantly share code, notes, and snippets.

View t0mab's full-sized avatar

t0mab t0mab

View GitHub Profile
@t0mab
t0mab / rofi-emoji.sh
Created February 24, 2018 00:55 — forked from tadly/rofi-emoji.sh
Rofi emoji picker
#!/usr/bin/env bash
#
# Use rofi to pick emoji because that's what this
# century is about apparently...
#
# Requirements:
# rofi, xsel, curl, xmllint
#
# Usage:
# 1. Download all emoji
@t0mab
t0mab / Pure CSS search input.markdown
Created July 3, 2017 21:57
Pure CSS search input
@t0mab
t0mab / VagrantFile.rb
Created June 9, 2017 00:10 — forked from marktheunissen/VagrantFile.rb
Running Ansible on a Vagrant machine without a plugin
Vagrant::Config.run do |config|
config.vm.define :default do |tw_config|
tw_config.vm.box = "precise64"
tw_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
tw_config.vm.provision :shell, :path => "provision/ansible-setup.sh"
tw_config.vm.provision :shell, :path => "provision/controller-setup.sh"
# Load a local setup file if it exists, so you can use it to
# provide additional provisioning steps.
@t0mab
t0mab / snippets.cson
Created April 19, 2017 09:06
Atom snippet pour Schnapsum ! (aller dans Atom -> snippets -> c/c)
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@t0mab
t0mab / github-notifications
Created April 6, 2017 09:07 — forked from mdibaiee/github-notifications
GitHub Notifications in i3bar
#!/bin/bash
# put this in your bin directory, e.g. /usr/bin or ~/.local/bin
sleep 20 # update interval
# you have to generate a new ACCESS_TOKEN for yourself here (https://github.com/settings/tokens, you only need "notifications" access) and replace the value
response=$(curl -s https://api.github.com/notifications?access_token=ACCESS_TOKEN)
if [[ $response =~ "{" ]]
@t0mab
t0mab / C-states.md
Created October 28, 2016 08:30 — forked from wmealing/C-states.md
What are CPU "C-states" and how to disable them if needed?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf.

Here we limit the system to only C-State 1:

    kernel /vmlinuz-2.6.18-371.1.2.el5 ... processor.max_cstate=1

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

@t0mab
t0mab / 3-postgres-tips.md
Created October 17, 2016 15:12 — forked from nepsilon/3-postgres-tips.md
3 tips for a better PostgreSQL usage — First published in fullweb.io issue #38

3 tips for a better PostgreSQL usage

We’ll see how to write queries in your editor, format output based on content and how to get info on everything.

1. Use your editor to write queries:

Tell the terminal what editory to use with from your bash shell export EDITOR=subl, then in psql type:

psql> \e
@t0mab
t0mab / fuzzy-search-postgres.md
Created October 17, 2016 15:12 — forked from nepsilon/fuzzy-search-postgres.md
PostgreSQL: Native fuzzy search with levenshtein() — First published in fullweb.io issue #41

PostgreSQL: Fuzzy search with levenshtein()

Ever wanted to implement a “Did you mean?” feature in your search results? Google is said to have greatly increased its user engagement with it. Here is how to implement it simply in Postgres (v9.1+):

Install the extension:

CREATE EXTENSION fuzzystrmatch;
@t0mab
t0mab / 2-front-end-tips-to-keep-in-mind.md
Created October 17, 2016 14:58 — forked from nepsilon/2-front-end-tips-to-keep-in-mind.md
2 front-end tips to keep in mind — First published in fullweb.io issue #68

2 front-end tips to keep in mind

1. Stop using .innerHTML = ''; when removing children to a DOM element.

On modern browsers it seems to be about 400× (!!) slower than this DOM-friendly method:

while (el.firstChild)
    el.removeChild(el.firstChild);
@t0mab
t0mab / autoexec.ash
Created July 31, 2016 16:40 — forked from KonradIT/autoexec.ash
GoPro HERO4 Session improvement hack (makes MSC USB connection and enables 10 second OLED screen timeout to save battery)
#Hack for hero4 session, makes it even more stoked and versatile.
t app usb msc
sleep 10
t app test oled brightness 0