Skip to content

Instantly share code, notes, and snippets.

View anton-rudeshko's full-sized avatar
❄️
Snowflake

Anton Rudeshko anton-rudeshko

❄️
Snowflake
View GitHub Profile
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@danieleggert
danieleggert / GPG and git on macOS.md
Last active May 3, 2024 12:26
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@jamescmartinez
jamescmartinez / slack_delete.rb
Last active January 4, 2021 21:28
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@bcomnes
bcomnes / .screenrc
Last active August 21, 2022 10:33
ssh agent forwarding in tmux and gnu screen
# Fix agent forwarding
# https://gist.github.com/martijnvermaat/8070533
# http://techblog.appnexus.com/2011/managing-ssh-sockets-in-gnu-screen/
# See .ssh/rc for socket linking
unsetenv SSH_AUTH_SOCK
setenv SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock.$HOSTNAME
@anton-rudeshko
anton-rudeshko / convert.sh
Last active October 17, 2020 01:01
Convert GoPro photos to timelapse video using ffmpeg CLI.
#!/usr/bin/env bash
# -r 60: 60 FPS
# -y: rewrite output file
# -start_number 11555: first frame number
# -i 'G%07d.JPG': file format
# -vf "crop=h=2250": video filter to crop input frame height from 3000 to 2250 (which will be eventually downscaled to 720)
# -c:v libx264: video codec x264
# -crf 20: x264 encoding quality (less = better)
# -s 1280x720: output size
#!/usr/bin/env bash
source tc-props.bash
echo "Running on $agent_name"
echo "Deploying $org_app_version to $org_deploy_server..."
# ...
@anton-rudeshko
anton-rudeshko / timestamp.js
Created July 18, 2014 12:19
Detect timestamp: seconds vs. millis
var isTimeStamp = (function(MAX_INT) {
return function(number) {
return parseInt(number, 10) > MAX_INT;
};
})(Math.pow(2, 31) - 1);
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
console.highlight = function(text, sample) {
var escapedSample = sample.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
var reSample = new RegExp(escapedSample, 'g');
var args = [''];
var highlightedText = text.replace(reSample, function(match) {
args.push('background-color: #ffc', 'background-color: none');
return '%c' + match + '%c';
});
args[0] = highlightedText;
console.log.apply(console, args);
@getify
getify / gist:86683eeaa13ac7474f04
Last active August 29, 2015 14:01
proposal: layered npm packages

Here's a quick proposal for something that I think would help npm packages (used as dependencies) be leaner, reducing burden of disk-space and bandwidth, especially for CI type setups which re-download tons of packages over and over again. My idea is inspired from Help People Consume Your npm Packages.

TL;DR

Add .npmignore-minimal file with things in your package that are not-strictly-necessary (readmes, tests, etc) to filter out of minimal-package installs. npm install still installs full package. npm min-install (or npm install --production) installs only the filtered down package contents (aka "minimal-package").

Details

This proposal pairs/parallels devDependencies, but extends this "optional" idea to your whole package structure.