Skip to content

Instantly share code, notes, and snippets.

View monsieurp's full-sized avatar

Patrice Clement monsieurp

View GitHub Profile
#!/usr/bin/env perl
use warnings;
use autodie;
use strict;
use feature qw#say#;
use Curses::UI;
use File::Find;
use vars qw#*name#;
@monsieurp
monsieurp / listbox.pl
Created July 13, 2020 17:52
Centered window and listbox demo using Perl Curses::UI module
#!/usr/bin/env perl
use warnings;
use strict;
use Curses;
use Curses::UI;
my $cui = Curses::UI->new(
-color_support => 1,
-clear_on_exit => 1
@monsieurp
monsieurp / window_centered.pl
Last active July 13, 2020 17:49
Create a centered window with a label using Perl Curses::UI module
#!/usr/bin/env perl
use warnings;
use strict;
use Curses;
use Curses::UI;
my $cui = Curses::UI->new(
-color_support => 1,
-clear_on_exit => 1
@monsieurp
monsieurp / urwid-bananas-apples-dialog.py
Last active June 23, 2020 19:44
dialog(1) like example with urwid using a single main loop.
#!/usr/bin/env python3
import urwid
from urwid import MainLoop
import time
import sys
import os
PALETTE = [
('s1_titlebar', 'white,bold', 'yellow'),
('s2_titlebar', 'white,bold', 'light green'),
@monsieurp
monsieurp / main.dart
Last active March 17, 2019 17:41
Dart classes
class Clazz {
static List<String> elements = ["foo", "bar"];
}
void main() {
var n = Clazz.elements;
for (int i = 0; i < n.length; i++) {
print(n[i]);
}
}
@monsieurp
monsieurp / blkid2fstab.bash
Created January 16, 2018 10:41
Parse the blkid output and turn it into a fstab compatible file.
#!/usr/bin/env bash
tmpfile=$(mktemp /tmp/blkid2fstab.XXXXXX)
blkid -o list | while read -r l; do
[[ ! ${l} =~ (^/dev/sd) ]] && continue
IFS=" " read -a line <<< "${l}"
fs="${line[1]}"
mountpt="${line[2]}"
uuid="UUID=${line[3]}"
package org.gentoo.java;
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static org.objectweb.asm.Opcodes.ACC_STATIC;
import static org.objectweb.asm.Opcodes.ACC_SUPER;
import static org.objectweb.asm.Opcodes.ALOAD;
import static org.objectweb.asm.Opcodes.ATHROW;
import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
import static org.objectweb.asm.Opcodes.RETURN;
import static org.objectweb.asm.Opcodes.V1_5;
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2, random
from xml.etree import ElementTree
# Turn an XML document into a string.
def fetch_document(my_url):
return [l.strip() for l in urllib2.urlopen(my_url).readlines()]
def main():
@monsieurp
monsieurp / eapi5.pl
Created March 31, 2015 08:12
eapi5.pl
#!/usr/bin/perl
use warnings;
use strict;
use Term::ANSIScreen qw/cls/;
use POSIX qw/strftime/;
use feature 'say';
# Current year.
my $year = strftime '%Y', gmtime;
@monsieurp
monsieurp / gist:311d3d5579d7a5600b13
Last active August 29, 2015 14:08
From mayhem to normality.
--- /usr/bin/echangelog 2014-11-02 17:34:41.730843075 +0100
+++ echangelog 2014-11-02 22:10:13.524146598 +0100
@@ -108,17 +108,14 @@
exit 0;
}
-sub getenv($) {
+sub getenv ($) {
my $key = shift;
+ my $env = $ENV{$key};