Skip to content

Instantly share code, notes, and snippets.

View epicsagas's full-sized avatar
🎯
Focusing

Sangseng Lee epicsagas

🎯
Focusing
View GitHub Profile
@kepano
kepano / obsidian-web-clipper.js
Last active July 4, 2024 10:08
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@marcoblos
marcoblos / login-without-password-and-without-copy-key-to-server.md
Created May 26, 2019 05:42
Step by step: create a pem file to login without password and without copy local keys to remote server. SSH authentication like AWS EC2.
  1. Login with account user (not root)
mkdir pem
cd pem
ssh-keygen -b 2048 -f identity -t rsa
  1. Copy public key contents to authorized_keys
@thehesiod
thehesiod / 1pass_dups.py
Last active October 5, 2023 17:09
1password duplicate remover (alpha, only run in debugger with breakpoints everywhere *g*)
#!/usr/bin/env python3
import json
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor
import html
import dictdiffer
import iso8601
@shinebayar-g
shinebayar-g / Fix redis server startup warnings, redis tuning performance on Ubuntu 16.04.md
Last active July 13, 2023 01:17
Fix redis server startup warnings, redis tuning performance on Ubuntu 16.04
  • Maximum Open Files
You requested maxclients of 10000 requiring at least 10032 max file descriptors.
Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
@pbredenberg
pbredenberg / phpenv-osx.sh
Last active April 5, 2020 09:20 — forked from christopher-hopper/phpenv-macos.sh
Install phpenv on OSX from homebrew packages.
#!/usr/bin/env bash
# vim: ai ts=2 sw=2 et sts=2 ft=sh
# Use this script to install or re-install
# multiple versions of PHP on MacOS.
#
# Usage:
# curl -L https://git.io/v52yY | bash
# Check OS.
@cdleon
cdleon / macbook-pro-2011-defective-gpu-fix.md
Last active June 3, 2024 16:56
Macbook Pro 2011 GPU Defect fix macOS Sierra and High Sierra
@iamstoick
iamstoick / php.md
Created July 26, 2017 07:03
How to check an average memory usage by single PHP-FPM process
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
ps --no-headers -o "rss,cmd" -C apache2 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
@simonhamp
simonhamp / AppServiceProvider.php
Last active June 12, 2024 11:05
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@BlueNexus
BlueNexus / python2pseudo.py
Last active May 10, 2024 11:05
Python to Pseudocode converter
import os.path
import re
'''
INSTRUCTIONS
1. Create a file with the following code
2. Put the file you want to convert into the same folder as it, and rename it to "py_file.py"
3. Add a "#F" comment to any lines in the code which have a function call that doesn't assign anything (so no =),
as the program cannot handle these convincingly
4. Run the converter file
@molotovbliss
molotovbliss / mysql-large-db-import
Created November 29, 2016 18:05
Importing Large DB faster MySQL Settings
Source: https://dba.stackexchange.com/questions/83125/mysql-any-way-to-import-a-huge-32-gb-sql-dump-faster
innodb_buffer_pool_size = 4G
innodb_log_buffer_size = 256M
innodb_log_file_size = 1G
innodb_write_io_threads = 16
innodb_flush_log_at_trx_commit = 0
Why these settings ?
innodb_buffer_pool_size will cache frequently read data