Skip to content

Instantly share code, notes, and snippets.

cuke() {
clear
cucumber --drb --tags @dev features/
if [ $? -eq 0 ]; then
echo ""
echo ""
echo "@dev test are fine. Running all the tests."
echo ""
cucumber --drb features/
if [ $? -eq 0 ]; then
@SkyWriter
SkyWriter / gist:29a3bfc9c9964ae32dc3c10c69f4f94a
Created September 30, 2016 17:12 — forked from milancermak/gist:3451509
Example of validating a recurring payment from Google Play using the Web server application OAuth 2.0 flow
import datetime
import httplib2
# to see in detail what's going on, uncomment
# httplib2.debuglevel = 4
from apiclient.discovery import build
from oauth2client.client import OAuth2Credentials, OAuth2WebServerFlow
if __name__ == "__main__":
@SkyWriter
SkyWriter / Example.hs
Created April 21, 2017 17:39 — forked from jferris/Example.hs
Arrows
{-# LANGUAGE Arrows #-}
import Control.Arrow
double :: Int -> Int
double x = x * 2
triple :: Int -> Int
triple x = x * 3
@SkyWriter
SkyWriter / JSON.hs
Created April 21, 2017 17:39 — forked from jferris/JSON.hs
Test.Hspec.JSON
module Test.Hspec.JSON
( shouldBeJson
) where
import Control.Monad (when)
import Control.Monad.State (StateT, get, modify, runStateT)
import Control.Monad.Writer (Writer, execWriter, tell)
import Data.ByteString.Lazy (ByteString)
import Data.Function (on)
import Data.Monoid ((<>))
@SkyWriter
SkyWriter / PDFUtil.java
Created October 18, 2017 14:29 — forked from jribble/PDFUtil.java
Flatten PDF documents using PDFBox
package pdfutil;
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSStream;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDResources;
@SkyWriter
SkyWriter / nes.py
Created May 19, 2019 08:11 — forked from karpathy/nes.py
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
"""
A bare bones examples of optimizing a black-box function (f) using
Natural Evolution Strategies (NES), where the parameter distribution is a
gaussian of fixed standard deviation.
"""
import numpy as np
np.random.seed(0)
# the function we want to optimize
@SkyWriter
SkyWriter / tmux-migrate-options.py
Created May 23, 2019 10:23 — forked from tbutts/tmux-migrate-options.py
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
# ffmpeg -i steep_turn_corrected.MOV -acodec copy -vcodec copy steep_turn_corrected.mp4
# exiftool -ProjectionType="equirectangular" photo.jpg
ffmpeg -i hatcher_birthday1.MOV -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate0.ts
ffmpeg -i hatcher_birthday2.MOV -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i "concat:intermediate0.ts|intermediate1.ts" -c copy -bsf:a aac_adtstoasc hatcher_birthday.mp4
@SkyWriter
SkyWriter / sidekiq_monitoring
Created February 28, 2020 12:02 — forked from ngsmrk/sidekiq_monitoring
Sidekiq queue checking via rails console
stats = Sidekiq::Stats.new
stats.queues
stats.enqueued
stats.processed
stats.failed
@SkyWriter
SkyWriter / pad_packed_demo.py
Created January 14, 2023 19:30 — forked from HarshTrivedi/pad_packed_demo.py
Minimal tutorial on packing (pack_padded_sequence) and unpacking (pad_packed_sequence) sequences in pytorch.
import torch
from torch import LongTensor
from torch.nn import Embedding, LSTM
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
## We want to run LSTM on a batch of 3 character sequences ['long_str', 'tiny', 'medium']
#
# Step 1: Construct Vocabulary
# Step 2: Load indexed data (list of instances, where each instance is list of character indices)