Skip to content

Instantly share code, notes, and snippets.

Szymon Krajewski skrajewski

Block or report user

Report or block skrajewski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@skrajewski
skrajewski / backup.sh
Last active Oct 17, 2019
Automate your macOS backup to Backblaze B2 using Restic and launchd.
View backup.sh
#!/bin/bash
PID_FILE=~/.restic_backup.pid
TIMESTAMP_FILE=~/.restic_backup_timestamp
if [ -f "$PID_FILE" ]; then
if ps -p $(cat $PID_FILE) > /dev/null; then
echo $(date +"%Y-%m-%d %T") "File $PID_FILE exist. Probably backup is already in progress."
exit 1
else
@skrajewski
skrajewski / keybase.md
Last active Sep 16, 2019
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am skrajewski on github.
  • I am skrajewski (https://keybase.io/skrajewski) on keybase.
  • I have a public key ASCSI-KUF183sZkTmzIqlLncVTha8L0s27RxQvMHK-vQIwo

To claim this, I am signing this object:

@skrajewski
skrajewski / README.md
Created Jan 27, 2019 — forked from bhstahl/README.md
A cli for launching/stopping Global Protect (and stopping it from auto-launching on restart)
View README.md
  1. Create a folder to hold your custom bash commands
$ mkdir ~/.bin
  1. Download the vpn file above to that directory
curl https://gist.githubusercontent.com/bhstahl/a90d747683ea0598c673e42d7f5a8900/raw/75cf1751c315795619399ef0e6b53a0297af3040/vpn --output ~/.bin/vpn
@skrajewski
skrajewski / README.md
Created Apr 27, 2018 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug
View README.md

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@skrajewski
skrajewski / backup.sh
Created Oct 1, 2017
Mirror local files to encrypted Cryptomator's vault
View backup.sh
#!/bin/sh
CRYPTOMATOR_PATH="/usr/local/bin/cryptomator-cli.jar"
DIR_TO_SYNC_PATH="$HOME/Private"
MOUNT_PATH="$HOME/VAULT_$RANDOM"
VAULT_PATH="$HOME/PATH/TO/ENCRYPTED/VAULT"
VAULT_PASSWORD="`security find-generic-password -a KEYCHAIN_ENTRY_VAULT_PASSPHRASE -w`"
VAULT_NAME="vault"
BIND_HOST="localhost"
BIND_PORT="8198"
@skrajewski
skrajewski / Dog.php
Created Nov 10, 2016
Create instance of me!
View Dog.php
<?php
class Dog {
private $dog;
public function __construct(Dog $dog)
{
$this->dog = $dog;
}
@skrajewski
skrajewski / Gulpfile.js
Created Mar 29, 2016
Gulpfile.js with browserify and external vendor file
View Gulpfile.js
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babelify = require('babelify');
var assign = require('lodash.assign');
var gutil = require('gulp-util');
var chalk = require('chalk');
@skrajewski
skrajewski / removeNbps.php
Last active Nov 1, 2019
Replace non-breaking spaces with normal spaces
View removeNbps.php
/**
* Replace non-breaking spaces with normal spaces
*
* @param $str
* @return string
*/
public function removeNbsp($str)
{
$str = htmlentities($str);
$str = str_replace("&nbsp;", " ", $str);
View resolutions.txt
1920x1200
1920x1080
1680x1050
1600x900
1440x900
1366x768
1360x768
1280x1024
1280x800
1280x720
View EAN13.php
class EAN13 {
protected $code;
public function __construct($code)
{
if (preg_match("/^[0-9]{12}$/", $code))
{
$this->code = $code . $this->calculateChecksumNumber($code);
}
You can’t perform that action at this time.