Skip to content

Instantly share code, notes, and snippets.

View divadsn's full-sized avatar
🎯
Focusing

David Sn divadsn

🎯
Focusing
View GitHub Profile
@codeb2cc
codeb2cc / gist:6280031
Created August 20, 2013 10:58
Nginx log format and GoAccess configuration.
# Nginx log format
log_format main '$remote_addr\t$remote_user\t$time_local\t$request_time\t$request\t'
'$status\t$body_bytes_sent\t$http_referer\t'
'$http_user_agent\t$http_x_forwarded_for';
# GoAccess configuration
# IMPORTANT: Replace all `\t` below with real tabs
date_format %d/%b/%Y:%T
log_format %h\t%^\t%d %^\t%T\t%r\t%s\t%b\t%R\t%u\t%^
@konklone
konklone / ssl-redirect.html
Last active January 2, 2024 15:09
Force a quick redirect to HTTPS on Github Pages for your domain (and only your domain)
<script>
var host = "YOURDOMAIN.github.io";
if ((host == window.location.host) && (window.location.protocol != "https:"))
window.location.protocol = "https";
</script>
while true; do
    ./adb shell input swipe 100 400 4000 400 400;
done
@alexxxdev
alexxxdev / gist:1dd024cadea091ca64154f9616d5739a
Created August 16, 2018 15:08
remote: fatal: pack exceeds maximum allowed size
# Adjust the following variables as necessary
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=500
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD
else
@divadsn
divadsn / docker-android.md
Last active December 9, 2018 10:23
Building Android using a pre-built Docker image on Linux or macOS (or even Windows).

Introduction

In this guide, I will show you how to deploy and run a pre-built build environment using Docker.
This guide is tested to run on Linux and macOS, but it should also work on Windows.

You are a pr0 thug dev and you only need the docker instruction? Click here.

Prerequisites

Your build machine should at least follow the minimum specs for building Android:

  • CPU: 4 cores with 2 GHz
  • Memory: 8 GB (recommended 12 GB if running with graphical environment)
<?php
set_time_limit(5);
error_reporting(0);
function in_range($num, ...$ranges) {
foreach ($ranges as $range) {
if (is_array($range)) {
if ($range[0] <= $num and $num <= $range[1]) {
return true;
@divadsn
divadsn / mta_install.sh
Last active May 1, 2021 01:36
All-in-one installation script for Multi Theft Auto on Linux. Requires wine with lib32 supported libraries.
#!/bin/bash
export WINEPREFIX=/home/$USER/.local/share/MultiTheftAuto
export WINEARCH=win32
wineboot -u
hexdump -n 4 -e '4/4 "%08X" 1 "\n"' /dev/urandom > $WINEPREFIX/drive_c/.windows-serial
winetricks -q d3dx9
@iwalton3
iwalton3 / jellyfin_extract_sub.py
Created March 27, 2021 04:15
Jellyfin Extract Subtitles
#!/usr/bin/env python3
# Based on https://github.com/EraYaN/jellyfin-stats
# pip3 install requests tqdm
URL = ""
API_KEY = ""
from re import sub
import requests
from tqdm import tqdm