Skip to content

Instantly share code, notes, and snippets.

#dates
chalange3 = /^(1\d{3}|20(0\d|1[02]))\/(0[1-9]|1[0-2])\/(0[1-9]|[1-2]\d|30)\s([0-1]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/
@gentoo90
gentoo90 / colorprompt.sh
Last active December 19, 2015 18:29
Put this file into "/etc/profiles.d/" and get colored prompt: green for users and red for root. Tested on CentOS 6.2 x64. Grabbed from http://bash.cyberciti.biz/guide/Changing_bash_prompt
# bash color prompt
bash_prompt_command() {
# How many characters of the $PWD should be kept
local pwdmaxlen=25
# Indicate that there has been dir truncation
local trunc_symbol=".."
local dir=${PWD##*/}
pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen ))
NEW_PWD=${PWD/#$HOME/\~}
local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))
@gentoo90
gentoo90 / ask_pass_if_not_saved.py
Created May 26, 2014 19:00
Ask password if not found in keyring
from getpass import getpass
try:
import keyring
def get_passwd(address, username):
passwd = keyring.get_password(address, username)
if passwd is None:
passwd = getpass('Password for %s: ' % address)
keyring.set_password(address, username, passwd)
return passwd
@gentoo90
gentoo90 / embed_kernel_cb.py
Created September 21, 2014 08:23
embed ipython kernel and automatically open console
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""
Embed IPython kernel and automatically open console
connected to it.
"""
import os
from zmq.eventloop.ioloop import IOLoop
import IPython
@gentoo90
gentoo90 / caja-syncthing.py
Created December 5, 2014 22:16
Syncthing integration for Caja
'''
Syncthing integration for Caja (MATE file manager)
1) Put it into ~/.local/share/caja-python/extensions
2) Install python-caja:
# sudo apt-get install python-caja
3) Install python-requests:
$ sudo add-apt-repository ppa:deluge-team/ppa
/*
* robotMaze.js
*
* The blue key is inside a labyrinth, and extracting
* it will not be easy.
*
* It's a good thing that you're a AI expert, or
* we would have to leave empty-handed.
*/
/***************
* pointers.js *
***************
*
* You! How are you still alive?
*
* Well, no matter. Good luck getting through this
* maze of rooms - you'll never see me or the Algorithm again!
*/
set DEP_OPENSSL_INCLUDE=C:\OpenSSL-Win64\include
set OPENSSL_INCLUDE_DIR=C:\OpenSSL-Win64\include
set OPENSSL_LIBS=ssleay32MT:libeay32MT
set OPENSSL_LIB_DIR=C:\OpenSSL-Win64\lib\VC
path C:\OpenSSL-Win64\bin;%PATH%
cargo test
--- sqlite_master.sql 2016-08-28 10:01:23.227790106 +0300
+++ sqlite_named_enums.sql 2016-08-28 09:26:14.223932432 +0300
@@ -60,7 +60,7 @@
build_id INTEGER NOT NULL,
url VARCHAR(2048),
PRIMARY KEY (id),
- CHECK (status IN ('bad', 'receiving', 'reviewing', 'processing', 'good')),
+ CONSTRAINT release_states CHECK (status IN ('bad', 'receiving', 'reviewing', 'processing', 'good')),
FOREIGN KEY(build_id) REFERENCES build (id)
);
@gentoo90
gentoo90 / .block
Last active July 23, 2019 10:12 — forked from akollegger/.block
Honeycomb Bloom Chart
license: mit