Value | Color |
---|---|
\e[0;30m | Black |
\e[0;31m | Red |
\e[0;32m | Green |
\e[0;33m | Yellow |
\e[0;34m | Blue |
\e[0;35m | Purple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import code; code.interact(local=dict(globals(), **locals())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' # for Mutex: Ruby doesn't provide out of the box thread-safe arrays | |
class ThreadPool | |
def initialize(max_threads = 10) | |
@pool = SizedQueue.new(max_threads) | |
max_threads.times{ @pool << 1 } | |
@mutex = Mutex.new | |
@running_threads = [] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A simple way to format numbers as human readable strings. | |
* E.g., 123456789 ==> 123 million | |
* | |
* Written by Christian Stigen Larsen | |
* http://csl.sublevel3.org | |
* | |
* Placed in the public domain by the author, 2012 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim: ai ts=4 sts=4 et sw=4 | |
""" | |
Tools to extract feed links, test if they are valid and parse them | |
with feedparser, returning content or a proper error. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# switch_touchscreen.sh | |
# https://ubuntuforums.org/showthread.php?t=2100744 | |
# Use `xinput --list` to list all devices and find your touchscreen | |
# sudo chmod a+x switch_touchscreen.sh | |
DEVICE="Atmel Atmel maXTouch Digitizer" | |
STATUS=`xinput list-props "$DEVICE" | grep 'Device Enabled' | sed 's/.*\([0-9]\)$/\1/'` | |
if [ "$STATUS" = "1" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# switch_touchscreen.sh | |
# https://ubuntuforums.org/showthread.php?t=2100744 | |
# sudo chmod a+x switch_touchscreen.sh | |
DEVICE="Atmel Atmel maXTouch Digitizer" | |
STATUS=`xinput list-props "$DEVICE" | grep 'Device Enabled' | sed 's/.*\([0-9]\)$/\1/'` | |
if [ "$STATUS" = "1" ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
require 'irb' | |
# Some monkey patch to add colorized output in console | |
class String | |
COLORS_CODE = { | |
red: 31, | |
green: 32, | |
yellow: 33, | |
blue: 34, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* process() { | |
console.log('Start process 1'); | |
console.log('Pause process2 until call next()'); | |
yield; | |
console.log('Resumed process2'); | |
console.log('Pause process3 until call next()'); | |
yield; |