Skip to content

Instantly share code, notes, and snippets.

View dpaluy's full-sized avatar

David Paluy dpaluy

  • Majestic Labs
  • Austin, TX
  • X @dpaluy
View GitHub Profile
@dpaluy
dpaluy / shell_goodies.sh
Last active December 13, 2019 22:14
Shell useful tools
# Total number of files in Folder
ls -l FOLDER | egrep -c '^-'
# Rename all files in Folder
for f in *; do [[ -f "$f" ]] && mv "$f" "UNIX_$f"; done
# or
ls | xargs -I {} mv {} Unix_{}
# output files from /dist to filenames.txt
find /dist -type f -maxdepth 1 > filenames.txt
@dpaluy
dpaluy / README-Template.md
Created April 18, 2019 02:10 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@dpaluy
dpaluy / split_tiff.sh
Created May 18, 2019 08:36
Split TIFF files into pages using GraphicMagic
#!/bin/bash
FILES="input/*.TIF"
SPLIT="_"
for filename in $FILES; do
fbname=$(basename "$filename" | cut -d. -f1)
gm convert "$filename" +adjoin "results/$fbname$SPLIT%01d.jpg"
done
@dpaluy
dpaluy / convert.sh
Last active September 20, 2019 09:24
Convert multipage images to JPG
#!/bin/bash
# Requires: http://www.graphicsmagick.org/
FILES="origin/*.TIF"
OUTPUT_FOLDER="results/"
SPLIT="_"
for filename in $FILES; do
fbname=$(basename "$filename" | cut -d. -f1)
@dpaluy
dpaluy / git_hacks.sh
Last active September 28, 2019 18:25
This shell script displays all blob objects in the repository, sorted from smallest to largest.
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
@dpaluy
dpaluy / calc_responsive_css.rb
Created October 22, 2019 10:16
Calculate Responsive CSS with Ruby
s0 = 375.0; x0 = 14.0
s1 = 1920.0; x1 = 90.0
v = ((x0 - x1) * 100) / (s0 - s1)
p = x0 - ((s0 / 100) * v)
puts "calc(#{p.round(2)}px + #{v.round(2)}vw)"
@dpaluy
dpaluy / large_commit.sh
Created October 27, 2019 18:43
Shows you the largest objects in your repo's pack file.
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# set the internal field separator to line break, so that we can iterate easily over the verify-pack output
@dpaluy
dpaluy / SignPDF.sh
Created November 9, 2019 19:39
A simple way to add a signature image to a pdf at given page under linux.
#!/bin/bash
#############################################################
# SignPDF: A simple way to add a signature image to a pdf at given page under linux.
# The inserted signature has the same aspect ratio than the original.
#############################################################
# Description:
# The script uses xv to display the page where the signature should be inserted. Click on two points inside xv with the left-mouse-button to define the signature's box corner. Don't maintain the mouse. It has to be two single clicks. The order of the click does not matter. Only the two last clicks are considered. Press q to quit xv. The signed file is generated in the same folder than the original, without overriding it. The signature keeps the same proportion than the original. You can move, but should not resize xv window.
#
# Written by : Emmanuel Branlard
# Date : April 2012
@dpaluy
dpaluy / background_script.js
Created November 9, 2019 20:03
how many chrome extension
"use strict";
function sanitizeLocalstorage() {
return !0
}
function setCache(e, t) {
localStorage[prefix + btoa(e)] = btoa(t);
var a = localStorage.howmany;
a ? (a = atob(a), a = parseInt(a) + 1) : localStorage.howmany = btoa(1), localStorage.howmany = btoa(a)
@dpaluy
dpaluy / linkedin_crawler.rb
Created November 9, 2019 20:08
Linkedin Crawler to get high quality images
require 'rubygems'
require 'mechanize'
require 'nokogiri'
@linkedin_username = "username"
@linkedin_password = "password"
agent = Mechanize.new
agent.user_agent_alias = "Mac Safari"
agent.follow_meta_refresh = true