Skip to content

Instantly share code, notes, and snippets.

View guycalledseven's full-sized avatar
:shipit:
Shipping it like it's 1999

Neven Jacmenović guycalledseven

:shipit:
Shipping it like it's 1999
View GitHub Profile
@guycalledseven
guycalledseven / reset-spotlight-search-location.sh
Created November 6, 2017 20:25
Reset Spotlight search location (macos El Capitan, Sierra)
defaults delete com.apple.Spotlight userHasMovedWindow
defaults delete com.apple.Spotlight userHasMovedWindow;defaults delete com.apple.Spotlight windowHeight;killAll Spotlight
2017-11-06 21:23:27.412 defaults[8180:686296]
Domain (com.apple.Spotlight) not found.
Defaults have not been changed.
2017-11-06 21:23:27.507 defaults[8181:686301]
Domain (com.apple.Spotlight) not found.
Defaults have not been changed.
/var/log/nginx/error.log
```
2017/11/14 00:33:30 [crit] 5117#5117: *224 open() "/var/lib/nginx/proxy/3/02/0000000023" failed (13: Permission denied) while reading upstream, client: 93.136.115.2, server: git.nivas.hr, request: "GET /css/semantic-2.2.10.min.css HTTP/1.1", upstream: "http://127.0.0.1:3000/css/semantic-2.2.10.min.css", host: "git.nivas.hr"
```
```
ps aux | grep "nginx: worker process"
nginx 5117 0.0 0.1 125644 6676 ? S 00:30 0:00 nginx: worker process
```
@guycalledseven
guycalledseven / nginx_issues.md
Last active March 28, 2022 19:49
bizarre nginx issues caused by incorrect file permissions

issues experienced

nginx error.log shows permission denied

nginx log in /var/log/nginx/error.log shows intereseting Error 13: Permission denied:

2017/11/14 00:33:30 [crit] 5117#5117: *224 open() "/var/lib/nginx/proxy/3/02/0000000023" failed (13: Permission denied) while reading upstream, client: 93.136.115.2, server: git.domain.tld, request: "GET /css/semantic-2.2.10.min.css HTTP/1.1", upstream: "http://127.0.0.1:3000/css/semantic-2.2.10.min.css", host: "git.domain.tld"
@guycalledseven
guycalledseven / Lorem.php
Created February 19, 2018 01:08
Lorem generator in PHP
<?php
// by user @mpen - https://stackoverflow.com/a/39986034/528020
// usage: Lorem::ipsum(4);
abstract class Lorem {
public static function ipsum($nparagraphs) {
$paragraphs = [];
for($p=0; $p<$nparagraphs; ++$p) {
$nsentences = random_int(3,8);
$sentences = [];
for($s=0; $s<$nsentences; ++$s) {
@guycalledseven
guycalledseven / haproxy.md
Last active April 16, 2024 12:40
haproxy conditions

Haproxy conditions

Since I keep forgetting them I've put them here.

To form a condition, you can use the following syntax after the rule that it applies to:

<HAProxy action statement> if|unless [!]acl1 <AND|OR|or|'||'> [!]acl2 ...

  • if - the condition is TRUE if the result of the ACLs is TRUE.
@guycalledseven
guycalledseven / manual-uninstall-parallels.sh
Last active March 14, 2024 14:17
Manually remove Parallels Desktop v15 leftovers MacOS
# used different forum posts/guides to figure this out like:
# The uninstall script is located at /Library/Parallels/Parallels Service.app/Contents/Resources
# https://github.com/danijeljw/remparallels/blob/master/remprls.sh
# https://kb.parallels.com/122461
# sudo find / -iname "*parallels*"
# sudo find / -iname "*prl*"
#before uninstalling deactivate your licencse - this won't be possible after uninstall
prlsrvctl deactivate-license
@guycalledseven
guycalledseven / manual-uninstall-cisco-webex.sh
Created June 27, 2020 10:53
Manual uninstall of Cisco Webex on macOS 10.15 Catalina
#!/bin/bash
#
# After downloading and running official Cisco Webex uninstaller (Cisco_WebEx_App_Uninstall), there is still a lot of Cisco Webex artifacts left on the system
# Cisco_WebEx_App_Uninstall.dmg.zip - https://cisco.bravais.com/s/4Kd44oJMbWksbTPQtvpw
#
rm -rf "/Users/$USER//Library/Application Support/Google/Chrome/Default/IndexedDB/https_tadawul.webex.com_0.indexeddb.leveldb"
rm -rf "/Users/$USER//Library/Application Support/Cisco/WebEx Meetings"
rm -rf "/Users/$USER//Library/WebKit/com.webex.meetingmanager"
rm -rf "/Users/$USER//Library/Logs/WebexMeetings"
@guycalledseven
guycalledseven / mongodb-date-time-info.md
Last active March 3, 2024 07:54
MongoDB Date and Time

MongoDB Dates

TLDR;

When working with dates in MongoDB, you have to be extra careful because: MongoDB by default stores date & time in ISODate object which is in UTC/GMT. - without any timezone data appended to it. The idea is - that you convert the date in a correct timezone when you query it and display to the user. If you don't do that - you gonna have bad time. Literally. :) Day of birth should not get converted to local time zone, but should be stored as UTC and used as UTC.

Preface

I started writing this document as a reminder to my self when doing mongo stuff.