Skip to content

Instantly share code, notes, and snippets.

View fikriauliya's full-sized avatar

Pahlevi Fikri Auliya fikriauliya

View GitHub Profile
a
a-
aa
aaji
aal
aau
aaui
ab
ab-
aba
use std::io;
use std::str;
use std::convert::TryFrom;
use std::collections::HashMap;
use std::str::SplitAsciiWhitespace;
pub struct UnsafeScanner<R> { reader: R, buf_str: Vec<u8>, buf_iter: str::SplitAsciiWhitespace<'static>, }
impl<R: io::BufRead> UnsafeScanner<R> {
pub fn new(reader: R) -> Self { Self { reader, buf_str: vec![], buf_iter: "".split_ascii_whitespace(), } }
pub fn trim_newline(s: &mut String) { if s.ends_with('\n') { s.pop(); if s.ends_with('\r') { s.pop(); } } }
@fikriauliya
fikriauliya / .tmux.conf
Last active October 22, 2016 22:33
tmux
set-option -g prefix C-a
setw -g mode-keys vi
set -g default-terminal "screen-256color"
# status bar config
set -g status-left "#h:[#S]"
set -g status-left-length 50
set -g status-right-length 50
@fikriauliya
fikriauliya / tmux.md
Created September 2, 2016 03:48 — forked from andreyvit/tmux.md
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

contents = File.read('raw_rapbd.txt')
EXCEPTIONS = [/^Urusan Pemerintahan :/, /^Organisasi :/, /^Jumlah/, /^$/, /^Surplus\/\(Defisit\)/, /^Pembiayaan Netto/]
contents.each_line do |l|
l = l.strip
unless /^\d\.\d\d/.match(l)
if EXCEPTIONS.none? {|e| e.match(l)}
print(" #{l}")
else
print("\n#{l}")

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fikriauliya
fikriauliya / basic
Last active May 20, 2017 01:41
Most used VIM shortcuts (Config: https://github.com/amix/vimrc)
leader: ,
- ctrl + w + direction: move to selected window
- ctrl + w + ctrl + w: move to another window
- ctrl + w + =: male all window equals
- ctrl + w + _: maximize current window
- :hide: close current window
- :only: close other windows
- u: undo
- ctrl + r: redo
- G: go to last line
@fikriauliya
fikriauliya / tutorial_1.sh
Last active September 23, 2015 06:41
Docker
$ sudo docker run ubuntu:14.04 /bin/echo 'Hello world'
# The -t flag assigns a pseudo-tty or terminal inside our new container and the -i flag allows us to make an interactive connection by grabbing the standard in (STDIN) of the container.
$ sudo docker run -t -i ubuntu:14.04 /bin/bash
# A Daemonized Hello world
$ sudo docker run -d ubuntu:14.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"
1e5535038e285177d5214659a068137486f96ee5c2e85a4ac52dc83f2ebe4147
$ sudo docker ps
@fikriauliya
fikriauliya / gist:8894932
Last active August 29, 2015 13:56
Most used Laravel command
#Start server
php artisan serve
php artisan migrate:make create_users_table
php artisan migrate
php artisan db:seed
@fikriauliya
fikriauliya / gist:8894249
Last active August 29, 2015 13:56
Setting up PHP5.4, Laravel on Ubuntu 10.04
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
wget http://laravel.com/laravel.phar
sudo mv laravel.phar /usr/local/bin/laravel
sudo chmod ug+x /usr/local/bin/laravel
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod o-x /usr/local/bin/laravel