Skip to content

Instantly share code, notes, and snippets.

@reinink
reinink / query.sql
Last active Jan 22, 2022
Text search across multiple tables using MySQL
View query.sql
select
first_name,
last_name
from
users
left join
companies on companies.id = users.company_id
where (
companies.name like 'TERM%' or
first_name like 'TERM%' or
@MawKKe
MawKKe / split_ffmpeg.py
Last active Aug 7, 2021
MOVED TO: https://github.com/MawKKe/audiobook-split-ffmpeg | Split audio file with ffmpeg based on chapter metadata
View split_ffmpeg.py
#!/usr/bin/env python3
import sys
import os
import re
import subprocess as sub
import argparse
import tempfile
import json
from concurrent.futures import ThreadPoolExecutor, as_completed
@drakakisgeo
drakakisgeo / gist:48dcab1539612c82449b9757940ac7ee
Last active Nov 22, 2021
Print Access Token from Laravel Passport
View gist:48dcab1539612c82449b9757940ac7ee
<?php
namespace App\Traits;
use App\User;
use DateTime;
use GuzzleHttp\Psr7\Response;
use Illuminate\Events\Dispatcher;
use Laravel\Passport\Bridge\AccessToken;
use Laravel\Passport\Bridge\AccessTokenRepository;
@pryley
pryley / nativefier-dropbox-paper.md
Last active Apr 20, 2018
Nativefier customisations for Dropbox Paper
View nativefier-dropbox-paper.md

1. Create paper.css

body {
    -webkit-app-region: drag;
}
a,
button,
.ace-editor {
    -webkit-app-region: no-drag;
}
View tailwind-rgba.js
// Add this to your 'plugins' array in your tailwind config file.
// This creates classes suffixed with an opacity level for each bg colour
// For example, .bg-red would have .bg-red-10 through .bg-red-100 for 0.10% opacity background and 100% opacity respectively.
({addUtilities, config}) => {
let colors = config('colors', []);
const newColors = {};
let hexToRgb = (hex) => {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
@levelsio
levelsio / btc-eth-dca-buy.php
Last active Sep 2, 2021
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
View btc-eth-dca-buy.php
<?
//
// [ BUY BTC & ETH DAILY ON BITSTAMP ]
// by @levelsio
//
// 2017-08-23
//
// 1) buy $40/day BTC
// 2) buy $10/day ETH
//
@drakakisgeo
drakakisgeo / Check Spam source
Created Dec 2, 2016
Check Spam sourcein a shared server
View Check Spam source
grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n
More info at http://www.inmotionhosting.com/support/email/exim/find-spam-script-location-with-exim
@renatomefi
renatomefi / README.md
Last active Dec 13, 2021
Milhog start script for Ubuntu 14.04
View README.md

This is a simple way to install mailhog, might not be the best solution for everyone, you can look for repositories, still have to register the binary in the PATH, among other things, this is a manual simple install.

Binary download

Download mailhog from the releases page on github: https://github.com/mailhog/MailHog/releases Save the binary at /opt/mailhog/mailhog Give it executable permission chmod +x /opt/mailhog/mailhog

Init script

Download the gist: https://gist.github.com/renatomefi/d133fea9cb5a7b00f91edb24b83d9a31#file-init-d-mailhog-sh Put it at /etc/init.d/mailhog

@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active Jan 22, 2022
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2020.md

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@so0k
so0k / gist:cdd24d0a4ad92014a1bc
Last active Jul 20, 2021
droplet discovery over digitalocean private networks
View gist:cdd24d0a4ad92014a1bc

Digital Ocean recently released private networking support in their NYC2 Data center.

They also published a blog post on how to setup a new droplet with private networking. But one thing the post doesn't do is tell you how to scale your private network for many boxes. One approach is obviously to edit /etc/hosts (but this gets annoying when you add a new box). A better way is to create an internal DNS zone (via the digital ocean web interface) and have your droplets use it:

Steps

setup the internal DNS zone file

  1. Login to digital ocean
  2. Click "DNS" on the right hand menu