Skip to content

Instantly share code, notes, and snippets.

Avatar

Pahlevi Fikri Auliya fikriauliya

  • Singapore
View GitHub Profile
View basicinterpreter.rs
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(); } } }
View .tmux.conf
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 Sep 2, 2016 — forked from andreyvit/tmux.md
tmux cheatsheet
View tmux.md

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
View 0_rapbd_cleaner.rb
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}")
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fikriauliya
fikriauliya / basic
Last active May 20, 2017
Most used VIM shortcuts (Config: https://github.com/amix/vimrc)
View basic
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
View tutorial_1.sh
$ 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 Aug 29, 2015
Most used Laravel command
View gist:8894932
#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 Aug 29, 2015
Setting up PHP5.4, Laravel on Ubuntu 10.04
View gist:8894249
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
You can’t perform that action at this time.