Skip to content

Instantly share code, notes, and snippets.

@fomars
fomars / Makefile
Last active April 26, 2026 20:28
Secure local api keys management
.PHONY: add-secret chat aws-cli
add-secret:
@read -p "Secret name (e.g., some-api-key): " name; \
read -p "Secret value: " value; \
security add-generic-password -a "${USER}" -s "$$name" -w "$$value" -U; \
echo "✓ Secret '$$name' stored in Keychain"
chat:
@export ANTHROPIC_API_KEY="$$(security find-generic-password -s claude-api-key -w 2>/dev/null)"; \
#!/bin/sh
for f in ./*.mp3
do
bpm=$(bpm-tag -n "${f}" 2>&1 | grep -Eo '\d+\.\d+ BPM')
newname=$(echo "${f%.*} ${bpm}.mp3")
mv "${f}" "${newname}"
done
# widget
views:
# list of views
- area:
axis: left
stacked: False
metrics:
__overall__:
# list of metrics
@fomars
fomars / main.py
Created January 10, 2019 16:49
DeadFatNonagon created by fomars - https://repl.it/@fomars/DeadFatNonagon
def input_season():
map = {
'W': 'Winter',
'S': 'Spring',
'M': 'Summer',
'A': 'Autumn'
}
while True:
inp = input('Choose season: Winter(W), Spring(S),Summer(M), Autumn(A): ')
if inp.upper() not in map.keys():
@fomars
fomars / docs_cases.yaml
Created October 12, 2017 15:46
documentation cases
autostop:
description: list of autostop constraints
type: list
schema:
type: string
default: []
#----------------------------
gun_config:
@fomars
fomars / FBxo-0.py
Created January 6, 2017 02:51
null created by fomars - https://repl.it/FBxo/0
# power set
def pop_element(s):
if len(s) > 0:
element = next(iter(s))
return element, s - {element}
else:
return None, frozenset()
def power_set_step(carry, remaining):
function split(arr){
return arr.reduce(function(a, b){
if (b < 0) {
return a.end_chunk(b)
}
else {
return a.add_to_last_chunk(b)
}
}, {
chunks: [[]],
# coding=utf-8
from urllib2 import urlopen
import page_objects
__author__ = 'Arseniy'
import os
import webapp2
import jinja2
import lxml.html as html
(define (sum-integers-1 a b)
(if (> a b)
0
(+ a (sum-integers-1 (+ a 1) b))))
(define (sum term a next b)
(if (> a b)
0
(+ (term a)
(sum term (next a) next b))))
(define (sum-integers-1 a b)
(if (> a b)
0
(+ a (sum-integers-1 (+ a 1) b))))
(define (sum term a next b)
(if (> a b)
0
(+ (term a)
(sum term (next a) next b))))