Skip to content

Instantly share code, notes, and snippets.

View meowgorithm's full-sized avatar
💭
Gosh

Christian Rocha meowgorithm

💭
Gosh
View GitHub Profile
@bashbunni
bashbunni / commits-since-last-version.sh
Created October 17, 2024 18:40
Helper script to view number of commits since last release
#!/usr/bin/env sh
# This is a helper script to decide when you might need a new release.
# Prints the number of commits between origin/main or origin/master and the latest release for the selected repos.
# provide a directory path that includes your repos
if [ -z $1 ]; then
echo "Please provide a path to a directory housing your repos"
exit 1
fi
@qapquiz
qapquiz / ask.sh
Created April 1, 2023 12:06
ask.sh (ask ChatGPT in command line)
#!/bin/bash
function ask_gpt() {
PROMPT=$(gum input --width 80 --placeholder "prompt")
if [[ -z "$PROMPT" ]]; then
exit 0
fi
gum style --foreground 212 "> $PROMPT"
@bashbunni
bashbunni / .zshrc
Created January 4, 2023 16:28
CLI Pomodoro for Linux
# study stream aliases
# Requires https://github.com/caarlos0/timer to be installed. spd-say should ship with your distro
declare -A pomo_options
pomo_options["work"]="45"
pomo_options["break"]="10"
pomodoro () {
if [ -n "$1" -a -n "${pomo_options["$1"]}" ]; then
val=$1
@davedelong
davedelong / DarkMode.applescript
Last active September 10, 2022 04:40
Toggle Dark Mode
on setDarkMode(shouldBeDark)
set paneID to "com.apple.preference.general"
tell application "System Events"
if dark mode of appearance preferences is shouldBeDark then return
end tell
set paneWasOpen to false
@simenbrekken
simenbrekken / KeyboardShortcutsMixin.js
Created August 31, 2014 08:15
React Keyboard Shortcuts Mixin
'use strict';
var KEYS = {
enter: 13,
left: 37,
right: 39,
escape: 27,
backspace: 8,
comma: 188,
shift: 16,
@markselby
markselby / node-express-redis-cache.js
Created October 28, 2013 02:19
Add Redis request caching to Node.js with Express.js.
var zlib = require('zlib');
var redis = require('redis');
var redisClient = redis.createClient();
var crypto = require('crypto');
// Our custom caching write function
function cached(body, lifetime, type) {
var key = this.req.originalUrl;
var res = this;
var etag, len;
@nickwaelkens
nickwaelkens / rot13.coffee
Last active December 16, 2015 12:58
ROT13 in CoffeeScript
# "stop, hammertime".rot13() // returns "fgbc, unzzregvzr"
# "fgbc, unzzregvzr".rot13() // returns "stop, hammertime"
String::rot13 = ->
this.replace /[a-zA-Z]/g, (c) ->
String.fromCharCode (if ((if c <= "Z" then 90 else 122)) >= (c = c.charCodeAt(0) + 13) then c else c - 26)
@jweir
jweir / redis-eventsource.go
Last active April 19, 2021 03:08
Example of using Redis PubSub and EventSource with golang
package main
import (
eventsource "github.com/antage/eventsource/http"
redis "github.com/vmihailenco/redis"
"log"
"net/http"
)
func haltOnErr(err error){
@gingerlime
gingerlime / change_db_owner.sh
Created April 24, 2012 19:32
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
<!-- For iPhone 4 with high-resolution Retina display: -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114-precomposed.png">
<!-- For first-generation iPad: -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png">
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">