Skip to content

Instantly share code, notes, and snippets.

View Korveld's full-sized avatar

Kirill Titov Korveld

View GitHub Profile
@Korveld
Korveld / Git resolve conflicts using theirs
Created April 29, 2026 10:00
Git resolve conflicts using theirs
git checkout --theirs .
git add .
git commit
git rebase --continue
If for any reason you want to bail out and undo the whole rebase:
git rebase --abort
Quick reminder:
--theirs = the branch being merged in (incoming)
@Korveld
Korveld / Generate graphql schema
Created January 24, 2026 14:25
Generate graphql schema manually
npm install -g graphqurl
gq https://your-wordpress-site.com/graphql --introspect > schema.graphql
@Korveld
Korveld / Wireguard mac os setup
Created October 24, 2024 09:48
Wireguard mac os setup
Read this somewhere earlier about using wireguard-go and cli to activate/deactivate wireguard working perfectly on Ventura while the Appstore wireguard app was not working properly.
1) Install wireguard-go and wireguard-tools with brew in terminal:
brew install wireguard-go wireguard-tools
2) Create the wireguard config directory and move your config file (exported from the Appstore wireguard app) to that directory:
sudo mkdir /usr/local/etc/wireguard
@Korveld
Korveld / PM2 cheat sheet
Last active October 31, 2024 18:28
PM2 cheat sheet
npm install pm2@latest -g
pm2 start "node --env-file=.env dist/server.js" --name ws-satchel
pm2 list
pm2 stop ws-satchel
pm2 restart ws-satchel
pm2 logs ws-satchel
pm2 delete ws-satchel
Auto-start on Server Reboot: To ensure your Node.js app starts automatically when the server reboots, run this command:
pm2 startup
@Korveld
Korveld / Supervisor cheat sheet
Last active October 16, 2024 06:42
Supervisor cheat sheet
sudo systemctl start supervisord
sudo systemctl enable supervisord
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start websockets
sudo supervisorctl status
Monitor Logs
tail -f /var/www/html/storage/logs/websockets.log
@Korveld
Korveld / Slick slider on mobile only
Created August 2, 2024 10:26
Slick slider on mobile only
/* Slick needs no get Reinitialized on window Resize after it was destroyed */
$(window).on('load resize orientationchange', function() {
$('.carousel').each(function() {
var $carousel = $(this);
/* Initializes a slick carousel only on mobile screens */
// slick on mobile
if ($(window).width() > 768) {
if ($carousel.hasClass('slick-initialized')) {
$carousel.slick('unslick');
}
@Korveld
Korveld / Ternary operator multiple conditions
Created July 24, 2024 09:29
Ternary operator multiple conditions
var foo = (
bar === 'a' ? 1 : // if
bar === 'b' ? 2 : // else if
bar === 'c' ? 3 : // else if
null // else
);
@Korveld
Korveld / MySql cheat sheet
Last active July 22, 2024 11:54
MySql cheat sheet
SELECT * FROM `wp_posts` ORDER BY `wp_posts`.`post_date` DESC
Drop column
ALTER TABLE wp_posts DROP COLUMN Created;
Add column
ALTER TABLE wp_posts ADD COLUMN post_author INT DEFAULT 1 AFTER ID;
Rename column
ALTER TABLE wp_posts CHANGE COLUMN LastEdited post_date DATETIME;
@Korveld
Korveld / "fatal: unable to create threaded lstat" error when run "git status" command
Created July 8, 2024 12:55
"fatal: unable to create threaded lstat" error when run "git status" command
If the resource limit can't be removed by the hosting provider, you could consider using git config to disable preloading of the index (threaded lstat).
git config core.preloadIndex false
If you need that setting when cloning the initial repository, then you will need to set it globally.
git config --global core.preloadIndex false
@Korveld
Korveld / Remove a folder from git tracking
Created June 3, 2024 18:55
Remove a folder from git tracking
Step 1. Add the folder path to your repo's root .gitignore file.
path_to_your_folder/
Step 2. Remove the folder from your local git tracking, but keep it on your disk.
git rm -r --cached path_to_your_folder/
Step 3. Push your changes to your git repo.