Skip to content

Instantly share code, notes, and snippets.

@nejni-marji
nejni-marji / tickets.py
Last active August 29, 2015 14:16
Ticket Problem
#!/usr/bin/python
import itertools
tick = range(1,25)
totals = [14, 16, 17, 18, 21, 22, 23, 24, 26, 29, 43, 47]
n = 2
# {{{ Making every permutation, skipping duplicates
perms = []
start = list(itertools.permutations(tick, r=n))
for i in start:
j = sorted(i)
#!/bin/bash
#set -x
# {{{ Preparing files
touch /tmp/bandcamp.m3u
rm /tmp/bandcamp.m3u
youtube-dl --ignore-errors --get-title --get-url -- $1 > /tmp/bctotal
# }}}
# {{{ Making playlist
export len=`cat /tmp/bctotal | wc -l`
for i in `seq $(($len/2))`; do
" {{{ autocommands
" This must be first because all other autocommands are loaded after it.
autocmd!
" spell check when not code
au syntax * if &syntax == " " | set spell | else | set nospell
" exiting insert mode when idle
autocmd CursorHoldI * stopinsert
autocmd InsertEnter * let updaterestore=&updatetime | set updatetime=10000
autocmd InsertLeave * let &updatetime=updaterestore
" line and column highlight in active window
#!/bin/bash
export DIR="$HOME/Pictures/Screenshots"
scrot "$@" --exec '
mv $f \$DIR/All/$f &&
mkdir -p \$DIR/%Y/%m/%d/ &&
ln \$DIR/All/$f \$DIR/%Y/%m/%d/%T-$wx$h.$t &&
ln -f \$DIR/All/$f \$DIR/Latest.$t &&
rm \$DIR/Today &&
#
# ~/.i3/config
#
set $mod Mod4
set $tree_meta g
set $mark_meta m
set $wksp_meta b
# startup
prefs.get = function prefsGet(group) [p.text for (p of values(this[group])) if (getPref(p.pref))];
info: using config file from: /home/matthew/.teleirc/config.js
15 Jun 13:00:43 - Sending irc NICK/USER
15 Jun 13:00:43 - ERROR: Error: Cannot find module 'node-icu-charset-detector'
15 Jun 13:00:43 - ERROR: Error: Cannot find module 'node-icu-charset-detector'
15 Jun 13:00:43 - ERROR: Error: Cannot find module 'node-icu-charset-detector'
15 Jun 13:00:44 - SEND: NICK nejni-marji-test-bot
15 Jun 13:00:45 - SEND: USER nejni-marji-test-bot 8 * :Telegram IRC Bot
15 Jun 13:00:50 - ERROR: Error: Cannot find module 'node-icu-charset-detector'
15 Jun 13:00:50 - ERROR: Error: Cannot find module 'node-icu-charset-detector'
15 Jun 13:00:50 - ERROR: Error: Cannot find module 'node-icu-charset-detector'
#!/bin/bash
#set -x
# {{{ getopts
while getopts ":i::o:p" VAR ; do
case $VAR in
i) # --input-file
export PLYDL_INPUT=$OPTARG
;;
o) # --output-file
export PLYDL_OUTPUT=$OPTARG
#!/bin/bash
#set -x
# {{{ getopts
while getopts ":i::o:p" VAR ; do
case $VAR in
i) # --input-file
export PLYDL_INPUT=$OPTARG
;;
o) # --output-file
export PLYDL_OUTPUT=$OPTARG
#!/usr/bin/env python
import re
import telegram as tg
import telegram.ext as tg_ext
def bang(bot, update):
print('bang')
text = update.message.text
bang = re.match('![a-zA-Z0-9]*', text).group()[1:]
resp = 'You used the bang: `{}`'.format(bang)