Skip to content

Instantly share code, notes, and snippets.

@alan-mushi
alan-mushi / progressbar.java
Created October 28, 2012 17:11
Barre de progression pour la console en java
public class progressbar {
public static void main( String[] args ) {
System.out.println( "[*] Running ..." ) ;
for ( int i = 1 ; i < 101 ; i++ ) {
System.out.flush() ;
System.out.print( "\r " + ( i == 100 ? "100" : " " + ( i < 10 ? " " + i : i) ) + " % " ) ;
System.out.print( "[" ) ;
for ( int j = 0 ; j < i-1 ; j++ ) { System.out.print( "=" ) ; }
@alan-mushi
alan-mushi / music
Last active July 17, 2016 14:47
Musique sympa
The Bewitched Hands - The laws of walls
The Bewitched Hands - Thank you, goodbye, it's over
Some Velvet Morning - How to start a revolution
Ellie Goulding - Your Song
Soma - Letters to unwrite
Angus and Julia Stone - Big Jet Plane
The Rolling Stones - Sympathy For The Devil
The Strokes - Machu Picchu
The Strokes - I'll Try Anything Once
Bloc Party - Banquet
@alan-mushi
alan-mushi / cmd_vim.md
Last active January 28, 2016 19:09
Cheatsheet commandes vim

Commandes vim

Déplacements :

		k
	h		l
		j

w / W : début du mot suivant / "Bigword"

@alan-mushi
alan-mushi / installation_workaround.md
Last active December 31, 2015 21:19
My archlinux setup on Dell Vostro 3460

Environnement graphique

Driver vidéo & touchpad

Driver Intel, supprimer les autres si ils ont été ajoutés

# pacman -S xf86-video-intel xf86-input-synaptics
@alan-mushi
alan-mushi / scrolling_form.c
Created July 11, 2014 12:38
This is a simple example of "scrolling" form with ncurses. It use "page" to allow forms with more fields than your window can print.
/*
* This is a simple example of "scrolling" form with ncurses.
* It use "page" to allow forms with more fields than your window can print.
*
* It prints a "label" (inactive field) and a regular field and let you
* "scroll" pages of the form.
*
* How to compile:
* gcc -o test scrolling_form.c -lform -lncurses
*/
@alan-mushi
alan-mushi / ncurses-simple-pop-up.c
Last active October 26, 2017 06:47
Very simple pop-up using ncurses form and menu library (not CDK) in C
/*
* Very simple pop-up using ncurses form and menu library (not CDK).
*
* The buttons are made from items and the fields are made from... well fields.
*
* How to run:
* gcc -o test -lmenu -lform -lncurses ncurses-simple-pop-up.c -g && ./test
*/
// Depending on your OS you might need to remove 'ncurses/' from the include path.
@alan-mushi
alan-mushi / popup.c
Created July 24, 2014 10:22
Simple pop-up using ncurses form and menu library (not CDK) in C. This is a bit more oriented towards easy integration rather than a stand-alone example.
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "popup.h"
static WINDOW *win_body;
static WINDOW *win_form;
static WINDOW *win_menu;
@alan-mushi
alan-mushi / va_list_ncurses.c
Created July 29, 2014 08:21
Simple wrapping of mvwprintw-like using va_list in ncurses
/*
* This is a simple example of va_list function in ncurses.
* I use it to wrap mvwprintw() and print something in a footer.
*
* How to run:
* gcc -o test va_list_ncurses.c -lncurses
*/
#include <ncurses.h>
#include <stdarg.h>
#include <stdio.h>
@alan-mushi
alan-mushi / fields_magic.c
Created July 29, 2014 10:05
Simple ncurses form example with fields that actually behaves like fields
/*
* Simple ncurses form example with fields that actually behaves like fields.
*
* How to run:
* gcc -Wall -Werror -g -pedantic -o test fields_magic.c -lform -lncurses
*/
#include <ncurses/ncurses.h>
#include <ncurses/form.h>
#include <assert.h>
#include <string.h>
@alan-mushi
alan-mushi / json_parser.c
Last active March 25, 2024 19:23
Examples for the json-c tutorial.
/*
* A simple example of json string parsing with json-c.
*
* clang -Wall -g -I/usr/include/json-c/ -o json_parser json_parser.c -ljson-c
*/
#include <json.h>
#include <stdio.h>
int main() {
struct json_object *jobj;