Skip to content

Instantly share code, notes, and snippets.

View it-can's full-sized avatar

M. Vugteveen it-can

View GitHub Profile
it-can /
Last active August 21, 2023 11:54
never type a sudo password again on mac. Uses gsed, install with: brew install gnu-sed
line_to_add="auth sufficient"
# Check if the line already exists in the file
if grep -q "$line_to_add" "$file"; then
echo "Line already exists in $file."
# Add the line after the comment lines
it-can / problem.txt
Last active July 2, 2019 17:00
Mariadb 10.4.6 problem
CREATE TABLE `test_table` (
`age_from` tinyint(2) NOT NULL,
`age_to` tinyint(2) NOT NULL,
`gender` enum('M','V') NOT NULL,
`norm_min` float NOT NULL,
`norm_max` float NOT NULL
ALTER TABLE `test_table`
ADD KEY `age_from` (`age_from`),
ulimit -a

mcedit /etc/sysctl.conf


fs.file-max = 100000
it-can / ApiRespond.php
Created November 20, 2016 09:52 — forked from dugajean/ApiRespond.php
Trait for easy creation of API responses
namespace App\Traits;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
trait ApiRespond
it-can / supervisord.service
Last active June 22, 2017 20:09 — forked from mozillazg/supervisord.service
install and configure supervisord on centos 7.
Description=supervisord - Supervisor process control system for UNIX
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
sudo pmset -a destroyfvkeyonstandby 1
sudo defaults write /System/Library/LaunchDaemons/ ProgramArguments -array-add "-NoMulticastAdvertisements"
sudo defaults write DSDontWriteNetworkStores -bool true
sudo defaults write DSDontWriteUSBStores -bool true
sudo pmset -a hibernatemode 0
#sudo pmset -a hibernatemode 3
sudo defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
sudo defaults write /Library/Preferences/SystemConfiguration/ Active -bool false
package sri
import (
func Generate256(file string) (string, error) {
it-can / pre-commit-dd
Last active May 22, 2016 12:24 — forked from martinbean/pre-commit
Pre-commit hook to detect if any files contain dd()
function contains($needle, $haystack)
return stripos($haystack, $needle) !== false;
$files = shell_exec('git diff-index --name-only --cached --diff-filter=ACMR HEAD');
$files = explode("\n", trim($files));
it-can / CacheRepository.php
Last active September 13, 2015 21:10 — forked from tillkruss/Database.php
[Laravel 5.1] Use Redis PECL/HHVM extension
namespace App\Repositories;
use Illuminate\Cache\Repository;
class CacheRepository extends Repository
public function has($key)
it-can / Dnstransip.php
Last active August 29, 2015 14:26 — forked from lennartvdd/transip-dyndns.php
// The domain to edit
define('DOMAIN', '');
// The authentication key
define('KEY', '69l67Le20e819360d3YHO1175');
// The DNS entries to update (name => content)
// This script will NOT add new entries