Skip to content

Instantly share code, notes, and snippets.

@boywijnmaalen
boywijnmaalen / Git cleanup repository
Last active March 28, 2024 11:04
Deletes all dangling commits, objects and blobs
# empty the stash
$ git stash clear
# objects can also be reached through the reflog.
# while branches record the history of some project, reflogs record the history of these branches.
# if you amend, reset etc. commits are removed from the branch history
# but git keeps them around in case you realize that you made a mistake.
# reflogs are a convenient way to find out what destructive (and other) operations were performed
# on a branch (or HEAD), making it easier to undo a destructive operation.
@boywijnmaalen
boywijnmaalen / KMS_office.cmd
Created October 10, 2021 16:37 — forked from Zibri/KMS_office.cmd
KMS server Windows
@echo off
title Microsoft Office 2019 versions are supported!&cls&echo
============================================================================&echo
#Project: Activating Microsoft software products for FREE without software&echo
============================================================================&echo.&echo
#Supported products:&echo - Microsoft Office Standard 2019&echo - Microsoft Office Professional Plus 2019&echo.&echo.&(if exist
"%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist
"%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b
..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('dir /b
..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo
@boywijnmaalen
boywijnmaalen / install swoole for multiple PHP versions.sh
Last active June 17, 2021 12:07
install swoole for multiple PHP versions
for i in "7.0 7.1 7.2 7.3 7.4 8.0"; do
if [ ! -d "/tmp/swoole-src" ]; then
cd /tmp
git clone https://github.com/swoole/swoole-src.git
;fi
cd /tmp/swoole-src \
if [ "${i}" = "7.0" ]; then
@boywijnmaalen
boywijnmaalen / 20210315_straced_#2
Created March 15, 2021 13:13
straced output PEST - segmentation error
This file has been truncated, but you can view the full file.
execve("./vendor/bin/pest", ["./vendor/bin/pest"], 0x7ffc5ba020d0 /* 27 vars */) = 0
brk(NULL) = 0x56171a1e0000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=22244, ...}) = 0
mmap(NULL, 22244, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe2b5b3e000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
@boywijnmaalen
boywijnmaalen / 20210315_straced
Created March 15, 2021 07:01
straced output PEST - segmentation error
execve("./vendor/bin/pest", ["./vendor/bin/pest"], 0x7fff35895520 /* 27 vars */) = 0
brk(NULL) = 0x55ccb0ed4000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=22244, ...}) = 0
mmap(NULL, 22244, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4e997cf000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
# cd into the right directory
$ find . -name \*.gz -print0 | xargs -0 zgrep -B 35 -A 35 "Search for string"
# -A show number of lines after an occurence
# -B show number of lines before an occurence
@boywijnmaalen
boywijnmaalen / Circumvent VPN for specific IP Address
Last active November 8, 2018 06:14
How to let websites and IPs bypass the VPN using static routing #UNIX #MacOsX
# https://support.hidemyass.com/hc/en-us/articles/202720646-How-to-let-websites-and-IPs-bypass-the-VPN-using-static-routing
# get gateway IP
```
$ route -n get default | grep gateway | awk '$1 == "gateway:" {print $2}'
```
# for every IP add an exception to route config
```
$ sudo route -nv add <destination IP> <gateway IP>
@boywijnmaalen
boywijnmaalen / Removing sensitive data from a repository
Last active November 5, 2018 10:57
Removing sensitive data from a repository #CLI #GIT
# source: https://help.github.com/articles/removing-sensitive-data-from-a-repository/
# these arguments will:
#
# force Git to process, but not check out, the entire history of every branch and tag
# remove the specified file, as well as any empty commits generated as a result
# overwrite your existing tags
#
# can only do one file at a time
# Method #1 - revert the file and create a new commit (safe method)
$ git checkout HEAD^ -- /path/to/file
$ git add /path/to/file
$ git commit -m "revert changes on this file, not finished with it yet"
$ git push origin HEAD
# Method #2 - revert the file and update the last commit ('uncommitting' method)
# use this method only if you know what you're doing
@boywijnmaalen
boywijnmaalen / Remove local branches except the master branch
Last active November 5, 2018 10:53
Remove local branches except the master branch
###########
# DRY-RUN #
###########
# make sure you are on develop; one cannot ever delete the current branch
$ git checkout develop
# get references
$ git fetch