Run: php create-phar.php
app.phar successfully created
Run: php app.phar
| // Write a pid file, but first make sure it doesn't exist with a running pid. | |
| func writePidFile(pidFile string) error { | |
| // Read in the pid file as a slice of bytes. | |
| if piddata, err := ioutil.ReadFile(pidFile); err == nil { | |
| // Convert the file contents to an integer. | |
| if pid, err := strconv.Atoi(string(piddata)); err == nil { | |
| // Look for the pid in the process list. | |
| if process, err := os.FindProcess(pid); err == nil { | |
| // Send the process a signal zero kill. | |
| if err := process.Signal(syscall.Signal(0)); err == nil { |
| <?php | |
| /** | |
| * GitLab Web Hook | |
| * See https://gitlab.com/kpobococ/gitlab-webhook | |
| * | |
| * This script should be placed within the web root of your desired deploy | |
| * location. The GitLab repository should then be configured to call it for the | |
| * "Push events" trigger via the Web Hooks settings page. | |
| * | |
| * Each time this script is called, it executes a hook shell script and logs all |
| <!doctype html> | |
| <title>Site Maintenance</title> | |
| <style> | |
| body { text-align: center; padding: 150px; } | |
| h1 { font-size: 50px; } | |
| body { font: 20px Helvetica, sans-serif; color: #333; } | |
| article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
| a { color: #dc8100; text-decoration: none; } | |
| a:hover { color: #333; text-decoration: none; } | |
| </style> |
Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.
gituser via Diskstation interface (with File Station and WebDAV privilages)git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.| $ redis-cli | |
| > config set stop-writes-on-bgsave-error no |
| // Don't forget to add Palette library to your build.gradle | |
| // compile 'com.android.support:palette-v7:+' | |
| public static int getDominantColor(Bitmap bitmap) { | |
| List<Palette.Swatch> swatchesTemp = Palette.from(bitmap).generate().getSwatches(); | |
| List<Palette.Swatch> swatches = new ArrayList<Palette.Swatch>(swatchesTemp); | |
| Collections.sort(swatches, new Comparator<Palette.Swatch>() { | |
| @Override | |
| public int compare(Palette.Swatch swatch1, Palette.Swatch swatch2) { | |
| return swatch2.getPopulation() - swatch1.getPopulation(); |
| <?php | |
| function get_private_key_for_public_key($public_key) { | |
| // extract private key from database or cache store | |
| return 'private_key_user_id_9999'; | |
| } | |
| // Data submitted | |
| $data = $_GET['data']; | |
| $data = json_decode(stripslashes($data), TRUE); |
To use a yubico U2F token on CentOS/RHEL/Fedora you need to add the specific udev file to your system to recognize them.
Get the udev rules
wget -O /etc/udev/rules.d/70-u2f.rules https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-u2f.rulesReload device events
| Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if | |
| a form sits there for a while (like a login form, but any the same) the csrf token in the form will | |
| expire & throw a strange error. | |
| Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner. | |
| In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T! | |
| Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function. | |
| All of your exceptions go through here, unless you have excluded them in the $dontReport array at the |