Skip to content

Instantly share code, notes, and snippets.

@rogerleite
rogerleite / install_monaco_font.sh
Last active April 27, 2024 05:27
Install Monaco font in Linux
#!/bin/bash
# Install Monaco font in Linux
# Version from nullvideo https://gist.github.com/rogerleite/99819#gistcomment-2799386
sudo mkdir -p /usr/share/fonts/truetype/ttf-monaco && \
sudo wget https://gist.github.com/rogerleite/b50866eb7f7b5950da01ae8927c5bd61/raw/862b6c9437f534d5899e4e68d60f9bf22f356312/mfont.ttf -O - > \
/usr/share/fonts/truetype/ttf-monaco/Monaco_Linux.ttf && \
sudo fc-cache
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Hippie expand. Groovy vans with tie-dyes.
;; Change the default hippie-expand order and add yasnippet to the front.
(setq hippie-expand-try-functions-list
'(yas/hippie-try-expand
try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name
@qrush
qrush / Inconsolata-dz-Powerline.otf
Created January 11, 2012 16:50
vim-powerline patched fonts
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@skyscribe
skyscribe / .gdbinit
Created October 30, 2012 03:04
GDB init file to print STL containers and data members
#
# STL GDB evaluators/views/utilities - 1.03
#
# The new GDB commands:
# are entirely non instrumental
# do not depend on any "inline"(s) - e.g. size(), [], etc
# are extremely tolerant to debugger settings
#
# This file should be "included" in .gdbinit as following:
# source stl-views.gdb or just paste it into your .gdbinit file
@kevinold
kevinold / .ackrc
Created February 10, 2013 13:54 — forked from hernamesbarbara/.ackrc
#ack is a tool like grep, designed for programmers with large trees of heterogeneous source code
#to install ack, see http://betterthangrep.com/
#to use ack, launch terminal (mac osx) and type 'ack <some_keywords>'
#ack will search all files in the current directory & sub-directories
#here's how I have my config file setup. this file is located on mac osx here
# ~/.ackrc
# Always sort the files
@sing1ee
sing1ee / gist:5971946
Last active March 27, 2024 06:37
Google面试题:扔鸡蛋问题

Google面试题:扔鸡蛋问题

原题描述

两个软硬程度一样但未知的鸡蛋,它们有可能都在一楼就摔碎,也可能从一百层楼摔下来没事。有座100层的建筑,要你用这两个鸡蛋通过最少的次数确定哪一层是鸡蛋可以安全落下的最高位置。可以摔碎两个鸡蛋

方法分析

看到这个题目,最保险的方法就是一层一层试验,但这样只需要一个鸡蛋就可以了。我们现在有两个鸡蛋,完全可以用有更快的方法。

@AndiH
AndiH / LaTeX Symbols.csv
Created September 7, 2013 09:00
List of LaTeX symbol to import in aText. Write the LaTeX command prepended by a ; and the text substition inserts the Unicode symbol for this LaTeX character. Based on this list: http://www.cl.cam.ac.uk/~mgk25/ucs/examples/TeX.txt, but expanded (and expandable) -- see comments!
;\aleph
;\forall
;\hbar
;\emptyset
;\exists
;\imath ı
;\nabla
;\neg ¬
;\surd
;\flat
@jstewart
jstewart / gist:7664823
Created November 26, 2013 19:40
Org-pomodoro notifications for OS X.
;; Needs terminal-notifier (brew install terminal-notifier)
(defun notify-osx (title message)
(call-process "terminal-notifier"
nil 0 nil
"-group" "Emacs"
"-title" title
"-sender" "org.gnu.Emacs"
"-message" message))
;; org-pomodoro mode hooks
@0minus273
0minus273 / gist:11320402
Created April 26, 2014 13:44
Peterson.java
public class Peterson {
public volatile boolean[] flag = new boolean[2];
public volatile int victim;
public void lock() {
int i = Integer.parseInt(Thread.currentThread().getName().substring(7)) - 1;
int j = 1 - i;
flag[j] = true;
victim = i;
while (flag[j] && victim == i) {}; // wait
}