Skip to content

Instantly share code, notes, and snippets.

📚
Learning. Always.

Sean Cooper sarcoma

📚
Learning. Always.
Block or report user

Report or block sarcoma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sarcoma
sarcoma / switch-case.js
Last active Jul 19, 2019
Switch String Case. Coverts camelCase or PascalCase to kebab-case or snake_case or any delimited string and vice versa,
View switch-case.js
const camelCaseToDelimitedString = (string, delimiter = '-') =>
string.replace(/([a-z0-9]|(?<!^)(?=[A-Z]))([A-Z])/g, '$1'+delimiter+'$2').toLowerCase();
const delimitedStringToCamelCase = (string, delimiter = '-') =>
string.replace(new RegExp(delimiter + '([a-z])', 'g'), (m, c) => c.toUpperCase());
View gist:8bfb29aa7c3557955faee39a873f302f
ffmpeg -f x11grab -y -r 30 -s 1920x1080 -i :0.0 -vcodec huffyuv out.avi
# Then convert it to .mp4
ffmpeg -y -i out.avi -s 1920x1080 -f mp4 -vcodec libx264 -preset slow -crf 18 -b:v 3000k -maxrate 4000k -bufsize 512k -c:a aac -b:a 128k -strict -2 out.mp4
# and remove the .avi
rm out.avi
@sarcoma
sarcoma / pngToGif.sh
Created Jun 12, 2019
Convert png to gif with ImageMagick
View pngToGif.sh
function pngToGif() {
while getopts ":i:o:" opt; do
case $opt in
i) input_file="${OPTARG}"
;;
o) output_file="${OPTARG}"
;;
\?) echo "Invalid option -${OPTARG}" >&2
;;
esac
@sarcoma
sarcoma / ffmpeg-stills-to-mp4
Created Jun 8, 2019
Command to convert a sequence of still images to and mp4 video. Using it for Processing3 Sketches.
View ffmpeg-stills-to-mp4
ffmpeg -f image2 -i image-%03d.png -s 640x360 -vcodec libx264 -preset slow -crf 18 -b:v 3000k -maxrate 4000k -bufsize 512k -c:a aac -b:a 128k -strict -2 weave-1.mp4
View .vimrc
set nocompatible
filetype off " required
syntax enable
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
View .Xresources
xterm*reverveVideo: false
xterm*selectToClipboard: true
xterm*saveLines: 4096
xterm*faceName: BitstreamVeraSansMono Nerd Font
xterm*faceSize: 11
xterm*vt100*geometry: 80x30
xterm*termName: xterm-color
xterm*eightBitInput: false
xterm*VT100.Translations: #override \
@sarcoma
sarcoma / sum_each_item_after.py
Last active Feb 28, 2019
Sum Each Item After
View sum_each_item_after.py
import time
import numpy as np
def timer(f, param):
start = time.time()
r = False
for i in range(1000):
r = f(param)
return (time.time() - start) / 1000 if r is not False else -1
View .bash_rsync_aliases
alias push-graph='rsync -avm --delete --progress ~/<LOCAL_DIR>/* <USER>@<SERVER_IP_ADDRESS>:/var/www/html/'
@sarcoma
sarcoma / CSVDownload.php
Last active Jan 12, 2019
CSV Download
View CSVDownload.php
<?php
/**
* Class CSVDownload
*/
class CSVDownload {
/**
* @var array
*/
@sarcoma
sarcoma / generate_secret
Created Dec 23, 2018
Terminal Generate Secret Key
View generate_secret
function secret() {
</dev/urandom tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c 32 ; echo
}
You can’t perform that action at this time.