Skip to content

Instantly share code, notes, and snippets.

# run "bc -l" and then...
define fpow(a, b) { return e(b * l(a)); }
# example (calculate monthly percent by year percent): pow(1.08, 1/12)
# 1.00643403011000345482
@d9k
d9k / delete-zero-length.sh
Last active November 27, 2015 01:18
vkopt output mp3 shuffle download
#/bin/bash
find tracks -size 0c -delete
//see https://github.com/mfunkie/react-overlay
import { Overlay } from 'react-overlay';
// or
const { Overlay } = require('react-overlay');
// or
var Overlay = require('react-overlay').Overlay;
@d9k
d9k / hg-log-compact-template-2.sh
Last active April 28, 2016 00:32
hg log templates
hg log -G -l 10 --template "{rev} [{phase}] {date|isodate}, {author|person}, {node}\n {desc}\n\n"
#210 [public] 2016-04-23 02:41 +0300, d9k, 117988d537c4bfc178e44ef562a41944c1bdb942
# one click buy form: payment system field
@d9k
d9k / tree.md
Created June 3, 2016 10:42 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

scramble = lambda word: [''.join(x) for c in range(len(word)) for x in itertools.combinations(word,c)]
# example:
# >>> scramble('sample')
# ['', 's', 'a', 'm', 'p', 'l', 'e', 'sa', 'sm', 'sp', 'sl', 'se', 'am', 'ap', 'al', 'ae', 'mp', 'ml', 'me', 'pl', 'pe', 'le', 'sam', 'sap', 'sal', 'sae', 'smp', 'sml', 'sme', 'spl', 'spe', 'sle', 'amp', 'aml', 'ame', 'apl', 'ape', 'ale', 'mpl', 'mpe', 'mle', 'ple', 'samp', 'saml', 'same', 'sapl', 'sape', 'sale', 'smpl', 'smpe', 'smle', 'sple', 'ampl', 'ampe', 'amle', 'aple', 'mple', 'sampl', 'sampe', 'samle', 'saple', 'smple', 'ample']
# inspired by http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html
#!env php
<?php
//script is intended to run from site directory
//tested on Joomla 2.5
$currentDir = getcwd();
echo "Running from \"${currentDir}\"\n";
$configPath = $currentDir.'/configuration.php';
$backupFolderPath = $currentDir.'/.backupdb';
$backupPath = $backupFolderPath.'/backup.sql';
======================================================================
Survival Time: 4 days, 11.52 hours.
2016.12.25 06:27
Final Moments:
Dogman Leader grazed Player's upper stomach with a claw.
Dogman attacks Player...and hits!
@d9k
d9k / random-exercise.lua
Last active December 25, 2016 23:44
random-exersise.lua
#!/usr/bin/env lua
-- needs luacoket module:
-- `sudo luarocks install luasocket`
exercises=[[
отжимания, 5 раз
мостик, 8 секунд
приседания, 5 раз
пресс, 6 раз
подтягивания, 2 раза
@d9k
d9k / readme.md
Last active August 15, 2017 02:56
Babel compressor for jinja assets compiler (see https://github.com/jaysonsantos/jinja-assets-compressor/issues/51)

Got to work with local node_modules installation.

  1. At your app folder: npm install --save babel-cli babel-preset-es2015 babel-preset-react babel-preset-stage-0
  2. manual run to test babel installation: node_modules/.bin/babel --presets=es2015,stage-0,react

input:

`let a = 5; console.log(a);