Skip to content

Instantly share code, notes, and snippets.

View yanshiyason's full-sized avatar

Shiyason yanshiyason

View GitHub Profile
@yanshiyason
yanshiyason / git-find-me-the-fucking-deleted-file.sh
Created December 20, 2021 00:43 — forked from joakin/git-find-me-the-fucking-deleted-file.sh
finding a deleted file in a git repository
# If you don't remember the exact path/name, search the log for deleted files
git log --diff-filter=D --summary | grep delete
# Find the file you want to get from the ouput, and use the path
# Find the commits that involved that path
git log --all -- some/path/to/deleted.file
# Bring the file back to life to the current repo (sha commit of parent of commit that deleted)
git checkout shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file
#!/usr/bin/env ruby
# frozen_string_literal: true
# rubocop:disable Metrics/LineLength, Metrics/MethodLength
#
# _________ ________ __________
# \_ ___ \ \_____ \\______ \
# / \ \/ / | \| | _/
# \ \____/ | \ | \
# \______ /\_______ /______ /
@yanshiyason
yanshiyason / du_sort.sh
Created April 2, 2019 07:57
disk usage with sort
#!/bin/bash
du -sh * | gsort -h | tail -r --
func laterInTime(days time.Duration, do func()) {
resetTime := func() {
jwt.TimeFunc = func() time.Time {
return time.Now()
}
}
defer resetTime()
jwt.TimeFunc = func() time.Time {
return time.Now().Add(time.Hour * 24 * days)
// usage:
// cy.poll({
// fn: () => cy.request(...),
// until: response => response.body.count === 1,
// assertFn: response => expect(response.body).to.deep.eq({
// count: 1,
// }),
// timeout: 120000,
// interval: 10000,
// })
@yanshiyason
yanshiyason / reddit api docs (json)
Last active October 14, 2018 14:18
Parse the reddit API docs and return them as JSON
require 'nokogiri'
require 'json'
html = `curl 'https://www.reddit.com/dev/api/' \
-H 'authority: www.reddit.com' \
-H 'cache-control: max-age=0' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' \
-H 'referer: https://www.google.co.jp/' \
// * ===== Colemak =====
// *
// * Kinesis Advantage 2 Colemak Layout File Copyright 2016 by Greg Dietsche.
// * Licensed under the MIT License.
// * See LICENSE file in the project root for full license information.
// *
// * Colemak was created by Shai Coleman and is in the Public Domain.
// *
// * Learn more about Colemak here: https://colemak.com/
// *
  1. Generate phoenix app
$ mix phx.new phx_react
Fetch and install dependencies? [Yn] y
  1. Generate react app in the assets directory
#!/usr/bin/env bash
#
# Simple file and folder renaming utility.
#
# Makes use of the [sharkdp/fd](https://github.com/sharkdp/fd) find script
# to rename files and folders
#
# Usage example:
#