Skip to content

Instantly share code, notes, and snippets.

View ninovsnino's full-sized avatar

Nino Wicaksono ninovsnino

View GitHub Profile
@ninovsnino
ninovsnino / .gitconfig
Created October 25, 2020 05:58
git log alias
[alias]
lg = lg1
lg1 = lg1-specific --all
lg2 = lg2-specific --all
lg3 = lg3-specific --all
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
@ninovsnino
ninovsnino / Microsoft.PowerShell_profile.ps1
Created October 25, 2020 04:32
Pretty and minimalist PowerShell $Profile
# ninovsnino's PowerShell's $Profile
# http://ninovsnino.io/posts/prettyfy-powershell/
Import-Module posh-git
Import-Module oh-my-posh
Import-Module Get-ChildItemColor
Set-Theme Paradox
Set-Alias -Name npp -Value 'C:\Program Files\Notepad++\notepad++.exe' -Description "Alias to Notepad++"
Set-Alias -Name ll -Value Get-ChildItemColorFormatWide -Description "Alias ll to ColorFormatWide"
@ninovsnino
ninovsnino / c_set_and_clear_bit.c
Created March 10, 2017 00:43
bit set and clear example in c
#include "stdio.h"
#define ID_A 0x01
#define ID_B 0x02
int main() {
unsigned char type;
unsigned short result;
printf("size of unsigned char = %x\n", sizeof(unsigned char) );
@ninovsnino
ninovsnino / FizzBuzz.c
Created June 20, 2016 00:14
Fizz Buzz in C
#include <stdio.h>
int main( void )
{
int i;
for ( i = 1; i <= 100; i++ )
{
if ( !(i % 3) )
{
@ninovsnino
ninovsnino / test_ncurses.c
Created June 15, 2016 00:02
Example of ncurses usage
#include <stdio.h>
#include <ncurses.h>
int main( void )
{
printf( "Hello Ncurses!\r\n" );
getch( );
return ( 0 );
}
@ninovsnino
ninovsnino / ncurses_CMakeList.txt
Created June 14, 2016 23:56
CMake to link library, in this case is ncurses library
cmake_minimum_required(VERSION 2.8.9)
project (test_ncurses)
find_package(curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIR})
file(GLOB SOURCES "*.c")
add_executable(test_ncurses ${SOURCES})
@ninovsnino
ninovsnino / 0_reuse_code.js
Created June 14, 2016 23:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ninovsnino
ninovsnino / getch_in_linux.c
Created June 14, 2016 23:12
Create yourself getch in linux using <termios.h> and <stdio.h>
#include <termios.h>
#include <stdio.h>
static struct termios old, new;
/* Initialize new terminal i/o settings */
void initTermios(int echo)
{
tcgetattr(0, &old); /* grab old terminal i/o settings */
new = old; /* make new settings same as old settings */
@ninovsnino
ninovsnino / .vimrc
Last active May 29, 2016 03:36
vim load matchit and exclude directory in fuzzyfinder
" Load matchit.vim, but only if the user hasn't installed a newer version.
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
let g:fuf_file_exclude = '\v\~$'
\ . '|\.(o|png|PNG|JPG|class|CLASS|jpg|exe|dll|bak|swp|pyc|pyo)$'
\ . '|(^|[/\\])\.(hg|git|bzr)($|[/\\])'
\ . '|(^|[/\\])venv[/\\]'
@ninovsnino
ninovsnino / pyopenssl_x509_signverify_example.py
Last active November 2, 2023 14:29
PyOpenSSL example of self sign X509 with RSA key-pair to do sign and verify
from OpenSSL import crypto
from socket import gethostname
k = crypto.PKey()
k.generate_key(crypto.TYPE_RSA, 2048) # generate RSA key-pair
cert = crypto.X509()
cert.get_subject().C = "<country>"
cert.get_subject().ST = "<city>"