Skip to content

Instantly share code, notes, and snippets.

View Cxarli's full-sized avatar
🔓
'; DROP TABLE bugs --

Charlie Cxarli

🔓
'; DROP TABLE bugs --
View GitHub Profile
@anaisbetts
anaisbetts / stat-cache.js
Last active April 11, 2019 05:07
Make your Electron apps load faster, with this One Weird Trick
// Include this at the very top of both your main and window processes, so that
// it loads as soon as possible.
//
// Why does this work? The node.js module system calls fs.realpathSync a _lot_
// to load stuff, which in turn, has to call fs.lstatSync a _lot_. While you
// generally can't cache stat() results because they change behind your back
// (i.e. another program opens a file, then you stat it, the stats change),
// caching it for a very short period of time is :ok: :gem:. These effects are
// especially apparent on Windows, where stat() is far more expensive - stat()
// calls often take more time in the perf graph than actually evaluating the
@Cxarli
Cxarli / StringPlus.php
Created April 27, 2016 19:42
A PHP framework for making it easier to do common string functions
<?php
class StringPlus {
public $str = '';
public function __construct($string) {
// Convert booleans
if ( $string === true ) {
$this->str = "true";
} else if ($string === false) {
$this->str = "false";
@Cxarli
Cxarli / Main.java
Created December 8, 2015 21:08
Histrogram
package xyz.mycharlie.colourhistogram;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
public class Main {
public int[][] createRGBData(BufferedImage img) {
int[] R=new int[256], G=new int[256], B=new int[256];
@winny-
winny- / gist:bb17853ffc76fbb9b039
Created November 13, 2015 01:38 — forked from nathanielc/gist:9b98350ccbcbf21256d7
Minecraft systemd unit file that uses tmux instead of screen
[root@plex ~]# cat /etc/systemd/system/minecraft@.service
[Unit]
Description=Minecraft Server %i
[Service]
WorkingDirectory=/opt/minecraft-%i
User=mcserver
Type=forking
ExecStart=/usr/bin/tmux new-session -s mc-%i -d '/bin/java -Xmx2048M -jar minecraft_server.jar nogui'
cd git
git clone git@github.com:C-Bouthoorn/SpeedProgramming.git
cd ..
mkdir lighttpd
cp ./git/SpeedProgramming/lighttpd/* .
@kylebgorman
kylebgorman / dense-search.py
Created October 11, 2015 03:19
dense crossword puzzle search
#!/usr/bin/env python
# Python 3.5 or greater, but probably backportable with minimal effort.
"""Creates dense crossword puzzle fills.
This module provides code to fill dense cross-word puzzles. It is a work
in progress.
We represent words in a puzzle as a square matrix of bytes.