Skip to content

Instantly share code, notes, and snippets.

@ogra
ogra / brew-new-md.py
Last active March 4, 2026 08:04
Output Markdown text (name, url, description) from newly added Homebrew Formulae/Casks info.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This script is designed to parse the output of `brew update` commands,
# extract relevant information about new formulae and casks, and then format that information
# for display. It uses regular expressions to identify and extract the name, version, URL,
# and description of each item. The script also includes debug statements to help trace the
# processing of the information. The final output is a formatted list of new formulae and casks
# with their details.
@ogra
ogra / .zshrc
Created January 13, 2025 01:43
Autostart Zellij with terminals other than Warp.
if [[ "$TERM_PROGRAM" != "WarpTerminal" ]]; then
if [[ -z "$ZELLIJ" ]]; then
if [[ "$ZELLIJ_AUTO_START" != "false" ]]; then
if command -v zellij >/dev/null 2>&1; then
eval "$(zellij setup --generate-auto-start zsh)"
fi
fi
fi
fi
@ogra
ogra / exclude_dropbox_sync.sh
Created December 15, 2021 02:35
Exclude node_modules directory from syncing on Dropbox. (macOS)
#!/bin/bash
EXCLUDEDIR=node_modules
EXLUDEDIR_FULL="`pwd`/$EXCLUDEDIR"
if [[ -d "$EXCLUDEDIR" ]]
then
echo "$EXCLUDEDIR exists on current directory."
else
echo "$EXCLUDEDIR deos not exist on current directory."
@ogra
ogra / blockstack_proof.txt
Created September 30, 2019 22:05
Blockstack proof
Verifying my Blockstack ID is secured with the address 12qNtCZZUWYwUQ5cW37vvJn5Mc6BKsZNqx https://explorer.blockstack.org/address/12qNtCZZUWYwUQ5cW37vvJn5Mc6BKsZNqx
@ogra
ogra / conv_audio_to_video.sh
Last active May 21, 2019 06:55
カレントディレクトリに置いた画像picture.png(ピクセル数は縦横ともに偶数)を使い、カレントディレクトリにあるaudioディレクトリにあるすべてのMP3ファイル(拡張子.mp3)をffmpegで動画に変換して、カレントディレクトリにあるvideoディレクトリにMP4ファイルとして保存するスクリプト
#!/usr/bin/env bash
for filename in ./audio/*.mp3; do
outputfile=`echo $filename | sed 's/^\.\/audio\//\.\/video\//' | sed 's/mp3$/mp4/'`
ffmpeg \
-loop 1 \
-r 30000/1001 \
-i picture.png -i $filename \
-vcodec libx264 \
-acodec aac -strict experimental -ab 320k -ac 2 -ar 44100 \

Keybase proof

I hereby claim:

  • I am ogra on github.
  • I am ogura (https://keybase.io/ogura) on keybase.
  • I have a public key whose fingerprint is 98F5 4678 F8A7 28C2 DB10 BC9F E0CA 6969 198E E985

To claim this, I am signing this object:

@ogra
ogra / articles.server.controller.tests.js
Created September 16, 2016 11:41
"MEAN Web Development" p.267-269 for the latest version of Should.js (Array(), Object() instead of Array, Object)
var app = require('../../server.js'),
request = require('supertest'),
should = require('should'),
mongoose = require('mongoose'),
User = mongoose.model('User'),
Article = mongoose.model('Article');
var user, article;
describe('Articles Controller Unit Tests:', function() {
@ogra
ogra / gist:2204403
Created March 26, 2012 10:46
returns if any elements in example_list are in example_string.
# the following code returns if any elements in example_list are in example_string.
True in [x in example_string for x in example_list]
# example: 'a' is in 'apple', so True is returned.
# >>> example_list = ['a', 'b', 'c']
# >>> example_string = 'apple'
# >>> True in [x in example_string for x in example_list]
# True
@ogra
ogra / FixChartAxes
Created August 9, 2011 12:45
Excel macro to make clustered charts' axes in the book start from zero.
Sub FixChartAxes()
'
' FixChartAxes Macro
'
' Define chart types to process
Dim chart_types As New Collection
With chart_types
.Add Item:=xlBarClustered
.Add Item:=xlColumnClustered
@ogra
ogra / console.py.20110802.diff
Created August 2, 2011 19:28
Scrapy 0.12.0.2543 scrapy/utils/console.py patch for IPython 0.11
--- console.py.orig 2011-07-31 08:01:34.000000000 +0000
+++ console.py 2011-08-02 20:38:56.000000000 +0000
@@ -11,7 +11,10 @@
if noipython:
raise ImportError
import IPython
- shell = IPython.Shell.IPShellEmbed(argv=[], user_ns=namespace)
+ if IPython.__version__ == '0.11':
+ shell = IPython.embed(user_ns=namespace)
+ else: