Skip to content

Instantly share code, notes, and snippets.

@AnoRebel
AnoRebel / dav_to_mp4.py
Last active August 22, 2024 12:49 — forked from jdye64/gist:ca07e01ff3d8e93210c3
Convert .dav files in current directory to .mp4
#!/usr/bin/python
print("Converting all of the .dav files in this current directory into .mp4 files using ffmpeg")
import os
from subprocess import call
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
ext = f.split(".")[-1]
if ext == "dav" or ext == "DAV":
@AnoRebel
AnoRebel / knexPostgresFullTextSearch.js
Created November 8, 2023 07:35 — forked from cameronblandford/knexPostgresFullTextSearch.js
Implement full text search using Knex + Objection
// Because we're using an ORM (Objection), it's a pain to add a tsvector when inserting,
// since tsvectors and FTS aren't supported by Objection. Instead, I've added a hook that
// fires on insert which auto-generates the tsvector field for each newly inserted entry.
// This is an example knex migration file for said behavior.
const addUserIndex = `
ALTER TABLE public.user ADD "document" tsvector;
CREATE FUNCTION my_trigger_function()
RETURNS trigger AS $$
@AnoRebel
AnoRebel / OTP_Input.html
Created May 22, 2023 16:23 — forked from tinshade/OTP_Input.html
Simple Bootstrap, JS code for OTP styled inputs. Feel free to make this mobile responsive.
<!DOCTYPE html>
<html>
<head>
<title>OTP Input</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<style>
*{
margin:0px;
padding:0px;
}
@AnoRebel
AnoRebel / git-fshow
Created February 4, 2021 11:12 — forked from akatrevorjay/git-fshow
Browsing git commit history with fzf
#!/bin/zsh
# git-fshow - git commit browser
#
# https://gist.github.com/akatrevorjay/9fc061e8371529c4007689a696d33c62
# https://asciinema.org/a/101366
#
git-fshow() {
local g=(
git log
@AnoRebel
AnoRebel / loc
Created February 4, 2021 10:02 — forked from akatrevorjay/loc
loc: mlocate + fzf integration
#!/usr/bin/env zsh
#
# loc: mlocate + fzf integration
#
# https://gist.github.com/06dc1238b2fcbfb6c10bbad05ad79bc1
# https://asciinema.org/a/102006
#
# ~ trevorj <[email protected]>
#
setopt pipe_fail err_return err_exit
@AnoRebel
AnoRebel / git-overwrite-branch.sh
Created November 2, 2020 16:02 — forked from ummahusla/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name
@AnoRebel
AnoRebel / app.js
Created September 22, 2020 17:02 — forked from eskiel777/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@AnoRebel
AnoRebel / emoji-toggle.md
Created July 5, 2020 18:06 — forked from HikariKnight/emoji-toggle.md
ibus emoji toggle
#!/bin/bash
#### CONFIG
ibus_default_layout="xkb:no::nor"
layout="no"
#### END OF CONFIG

ibus_layout=$(ibus engine)
if [[ "$ibus_layout" == $ibus_default_layout ]]; then
 echo Setting ibus to uniemoji
@AnoRebel
AnoRebel / custom_bottom_sheet.dart
Created June 17, 2020 13:55 — forked from drewpayment/custom_bottom_sheet.dart
Hack to fix Flutter not scrolling TextField and TextFormField into view to take viewInset of keyboard into account.
import 'package:flutter/material.dart';
class CustomBottomSheet {
static Future<T> showScrollingModalBottomSheet<T>({
@required BuildContext context,
bool isScrollControlled = true,
ShapeBorder shape,
double heightPercView = 0.95,
@AnoRebel
AnoRebel / bottom_sheet.dart
Created June 17, 2020 12:07 — forked from slightfoot/bottom_sheet.dart
Modal Bottom Sheet with Input Fields fix for Flutter (Fix issue with overlap with keyboard and fix for tapping to dismiss)
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';