Skip to content

Instantly share code, notes, and snippets.

@bf4648
bf4648 / handbrake.sh
Created Sep 19, 2021 — forked from ralphcrisostomo/handbrake.sh
Batch convert videos with HandBrake CLI
View handbrake.sh
#!/bin/bash
# Batch convert videos with HandBrake CLI
# By Ralph Crisostomo - 2016.04.17
#
# Usage :
# 'sudo ./handbrake.sh /source /destination'
#
# Reference :
# https://forum.handbrake.fr/viewtopic.php?f=6&t=19426
# https://gist.github.com/czj/1263872
@bf4648
bf4648 / .gdbinit
Created Aug 12, 2021 — forked from thobbs/.gdbinit
A version of .gdbinit that provides a pystack and pystackv command that does not hang forever. The problem appeared to be an infinite loop, so to fix it I just added a basic counter that breaks the while loop after 200 iterations.
View .gdbinit
# -*- ksh -*-
#
# If you use the GNU debugger gdb to debug the Python C runtime, you
# might find some of the following commands useful. Copy this to your
# ~/.gdbinit file and it'll get loaded into gdb automatically when you
# start it up. Then, at the gdb prompt you can do things like:
#
# (gdb) pyo apyobjectptr
# <module 'foobar' (built-in)>
# refcounts: 1
@bf4648
bf4648 / vim find
Created Jun 26, 2021 — forked from jinzhubaofu/vim find
vim find from hades
View vim find
'Find' : 'find')<CR>
" Find file in current directory and edit it.
function! Find(name)
let l:list=system("find . -type f | grep -i '".a:name."' | perl -ne 'print \"$.\\t$_\"'")
" let l:list=system("find . -iname '".a:name."' | perl -ne 'print \"$.\\t$_\"'")
" replace above line with below one for gvim on windows
" let l:list=system("find . -name ".a:name." | perl -ne \"print qq{$.\\t$_}\"")
let l:num=strlen(substitute(l:list, "[^\n]", "", "g"))
if l:num < 1
echo "'".a:name."' not found"
@bf4648
bf4648 / helpers.py
Created Jun 25, 2021 — forked from kennethreitz/helpers.py
Various Python helper functions
View helpers.py
# encoding: utf-8
""" Python General Helpers
Copyright (c) 2010 Kenneth Reitz. Creative Commons Attribution 3.0 License.
"""
import urllib, re, time, sys
import paramiko
@bf4648
bf4648 / com.startup.plist
Created Jun 24, 2021 — forked from fahim0173/com.startup.plist
Launch Demon Start up with Bash Script with MySQL Example
View com.startup.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Launch Daemon do not always have access to all the path variables
As a results, scripts will sometimes fail if the you are using path variables inside them
To enable the script to have access to all path variables, open up a terminal and type in -->
<!-- echo $PATH -->
<!-- You can opt to filter out some of the path variables which are not required by script-->
<key>EnvironmentVariables</key>
@bf4648
bf4648 / TextBookSearch.md
Created May 7, 2021 — forked from cmbaughman/TextBookSearch.md
Searching for Text Books
View TextBookSearch.md

Note: I found this on the /r/Piracy subreddit (https://www.reddit.com/r/Piracy/comments/3i9y7n/guide_for_finding_textbooks/?sort=confidence) however I am including a copy here just in case.

So you have a list of books you need to buy for college. There are some really great resources for finding them online, but I'm going to run through the easiest methods for searching all of them here.

First, let's start off by using the method that will allow you to find the vast majority of books. Google. It tends to be easier if you can search multiple sites at once, and this is the easiest way to do it.

There was a search engine that /u/ratokursi made 3 years ago, but by now most of the sites are either dead or have changed the url. I decided to make a new one, this time after reviewing 100+ sites and adding to working ones to the custom search engine.

https://cse.google.com/cse/publicurl?cx=011394183039475424659:5bfyqg89ers

@bf4648
bf4648 / installNextCloud-ssl.sh
Created Apr 30, 2021 — forked from autoize/installNextCloud-ssl.sh
NextCloud Install Script for Ubuntu 16.04, with automatic SSL by Let's Encrypt
View installNextCloud-ssl.sh
#!/bin/bash
# NextCloud Installation Script for Ubuntu 16.04
# with SSL certificate provided by Let's Encrypt (letsencrypt.org)
# Author: Autoize (autoize.com)
nextcloud_url='https://example.com' # Full URL of NextCloud instance
letsencrypt_domains='-d example.com -d www.example.com' # Hostname(s) to obtain SSL certificate for, following -d flag
letsencrypt_email='admin@example.com' # Admin contact email for Let's Encrypt
nextcloud_version='12.0.3' # Desired NextCloud version
@bf4648
bf4648 / crontab_header.sh
Created Apr 26, 2021 — forked from wesleyit/crontab_header.sh
A default crontab header that will make the life easier for those who don't remember cron fields or keywords.
View crontab_header.sh
## CRONTAB HINTS AND TIPS
##
##
## Entry Description Equivalent To
## @yearly (or @annually) Run once a year at midnight in the morning of January 1 0 0 1 1 *
## @monthly Run once a month at midnight in the morning of the first of the month 0 0 1 * *
## @weekly Run once a week at midnight in the morning of Sunday 0 0 * * 0
## @daily Run once a day at midnight 0 0 * * *
## @hourly Run once an hour at the beginning of the hour 0 * * * *
## @reboot Run at startup @reboot
@bf4648
bf4648 / mamp.md
Last active Apr 23, 2021 — forked from jfloff/mamp.md
How to get MAMP to work with SSL ... Yes really.
View mamp.md

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

@bf4648
bf4648 / tmux.conf
Created Apr 20, 2021 — forked from markandrewj/tmux.conf
Basic Tmux Status Bar
View tmux.conf
# ----------------------
# Status Bar
# -----------------------
set-option -g status on # turn the status bar on
set -g status-utf8 on # set utf-8 for the status bar
set -g status-interval 5 # set update frequencey (default 15 seconds)
set -g status-justify centre # center window list for clarity
# set-option -g status-position top # position the status bar at top of screen
# visual notification of activity in other windows