Skip to content

Instantly share code, notes, and snippets.

@stefanopulze
stefanopulze / spring_cors_kotlin
Last active June 25, 2018 15:42
Spring 5 - Cors
@Bean
fun webMvcConfiguration(): WebMvcConfigurer {
return object : WebMvcConfigurer {
override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/**").allowedMethods("*").allowedOrigins("*")
}
}
}
@stefanopulze
stefanopulze / Install update WordPress puglins directly.md
Created October 8, 2018 08:47 — forked from dianjuar/Install update WordPress puglins directly.md
Install update WordPress plugins without providing ftp access

Install WordPress plugins directly (without FTP)

Put this on your wp-config.php

/* That's all, stop editing! Happy blogging. */
define('FS_METHOD', 'direct');
@stefanopulze
stefanopulze / fix-gitlab-permission.sh
Created October 1, 2018 11:57
Fix gitlab folder permissions
# Holds repositories directory
sudo chown -R -v git:root /var/opt/gitlab/git-data
sudo chmod -R -v 0700 /var/opt/gitlab/git-data
# Holds git repositories
sudo chown -R -v git:git /var/opt/gitlab/git-data/repositories
sudo chmod -R -v 2770 /var/opt/gitlab/git-data/repositories
# Holds large object directories
sudo chown -R -v git:gitlab-www /var/opt/gitlab/gitlab-rails/shared
@stefanopulze
stefanopulze / owncloud-curl-upload
Created January 7, 2019 10:21
How to upload file to OwnCloud with CURL
curl -v -X PUT -su <user> --data-binary @"<file>" https://<owncloud-server>/remote.php/webdav/<owncloud-file>
@stefanopulze
stefanopulze / nginx-utils
Created March 1, 2019 21:16
When use nginx proxy pass and get Permission denied message
## Proxy pass - Permission denied
`setsebool httpd_can_network_connect true`
@stefanopulze
stefanopulze / mysql
Last active March 4, 2019 21:41
Useful mysql commands
# connect
mysql -u root -p
# List databases
show databases;
# create database
create database database-name;
# Create user
# Use snippet in configuration file
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name <your site>;
include snippets/letsencrypt.conf;
return 301 https://$server_name$request_uri;
}
@stefanopulze
stefanopulze / backup.sh
Last active April 16, 2019 12:49
Gitlab backup to ownCloud
#!/usr/bin/env bash
cd /var/opt/gitlab/backups/
gitlab-rake gitlab:backup:create
filename="$(ls -t /var/opt/gitlab/backups/ | head -1)"
date=$(date -I)
basicAuth="username:password"
remotedir="https://owncloud_remote_url/remote.php/webdav/backups" # make sure folder exists
@stefanopulze
stefanopulze / gist:cdea1d3deae99ac080bebef71fc5b587
Created May 17, 2019 12:45
Remove the shadow effect from screenshots on Mac
# Disable shadow
defaults write com.apple.screencapture disable-shadow -bool true ; killall SystemUIServer
# Enable shadow
defaults write com.apple.screencapture disable-shadow -bool false ; killall SystemUIServer
@stefanopulze
stefanopulze / gist:c51578cc3141493d93baa609a7c84bf3
Created October 21, 2019 15:13
HTTPS working on your local
https://www.freecodecamp.org/news/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec/