Skip to content

Instantly share code, notes, and snippets.

@samuelsmal
samuelsmal / how-to-enable-notes-export-from-kobo.md
Last active December 14, 2024 13:44
how to export notes and highlights from kobo

Steps

  1. connect kobo to your device
  2. open a file browser and navigate to the mounted kobo folder
  3. navigate to the hidden folder .kobo/Kobo
  4. open the file Kobo eReader.conf
  5. navigate to the section [FeatureSettings], if it doesn't exist, create it.
  6. add the line ExportHighlights=true and save
  7. disconnect the device
  8. now you can long press on a book and export the note file into a .txt file which will be saved alongside your books. to get it connect your ereader.
@sauloperez
sauloperez / signal_catching.rb
Last active December 14, 2024 13:43
How to catch SIGINT and SIGTERM signals in Ruby
# Signal catching
def shut_down
puts "\nShutting down gracefully..."
sleep 1
end
puts "I have PID #{Process.pid}"
# Trap ^C
Signal.trap("INT") {
@thecodewarrior
thecodewarrior / App Icon Template.svg
Last active December 14, 2024 13:42
An SVG template for creating macOS app icons, including guides and the standard drop shadow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dineshsaini
dineshsaini / gist:caf8fb2d53b315cf32f0d55092ef4c0e
Last active December 14, 2024 13:40
make gnome tracker disable or stop completely
#!/usr/bin/env bash
# make tracker3 daemon non workable & idompotent
# this script will reset its settings, and configure tracker3 daemon, to not let it do anyting.
# if other code has dependency on this tracker, then it will not break, but we also do achieve our goal.
# interpretation for org.freedesktop.Tracker3.Miner.Files enable-monitor from this file
# https://gitlab.gnome.org/GNOME/tracker-miners/-/blob/master/src/miners/fs/tracker-config.c
#Time in seconds before crawling filesystem (0->1000)
function isJQueryLoaded(){
if (window.jQuery) {
//jQuery is loaded
alert("jQuery sucessfully loaded!");
return true;
} else {
//jQuery is not loaded
alert("jQuery doesn't work!");
return false;
}
@yidas
yidas / codeiginter-server-config.md
Last active December 14, 2024 13:38
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment:

@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active December 14, 2024 13:31
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@jacobq
jacobq / update-dynamic-dns.sh
Last active December 14, 2024 13:31
FreeDNS (afraid.org) dynamic DNS updater script: e.g put in /etc/cron.hourly/update-dynamic-dns.sh
#!/bin/sh
# FreeDNS updater script
# Adapted from https://freedns.afraid.org/scripts/update.sh.txt
# sudo apt install dnsutils wget
DOMAIN="foo.my-custom-domain.com"
API_KEY="put your API key (base64 string) here"
SHOULD_UPDATE=0
# -f is the only argument supported right now (forces update even if address appears correct)
@lusbuab
lusbuab / sha-1.js
Last active December 14, 2024 13:29
Calculating SHA-1 in the Browser
async function sha1(str) {
const enc = new TextEncoder();
const hash = await crypto.subtle.digest('SHA-1', enc.encode(str));
return Array.from(new Uint8Array(hash))
.map(v => v.toString(16).padStart(2, '0'))
.join('');
}
// await sha1('hello, world!');
// outputs: 1f9d3c707d53f3d16c53dd73d70a6ce7596a9
@nathandaly
nathandaly / BaseResource.php
Last active December 14, 2024 13:27
Tenancy for Laravel & Filament V3 (Tenant per database)
<?php
/**
* Below is an the extended Filament resource your tenant panel resources
* will have to extend so that the queries are scoped properly.
*/
namespace App\Filament;
use Filament\Resources\Resource;