Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View koraysels's full-sized avatar

Koray S. koraysels

View GitHub Profile
@koraysels
koraysels / unzip.sh
Created December 14, 2023 10:07
unzip all zip files in folder and use the zip archive name as the folder root
#!/bin/bash
for zipFile in *.zip; do
fileName=$(basename "$zipFile" .zip)
echo "Extracting $zipFile..."
unzip -q "$zipFile" -d "$fileName"
newName=$(echo "$fileName" | cut -d '_' -f 1)
# Move the contents of the inner folder to the parent folder
#!/usr/bin/env bash
cd INF101AB
while read repo; do
git clone "$repo"
done < ../INF101AB.txt
cd ../INF102AB
while read repo; do
git clone "$repo"
@koraysels
koraysels / create_trellis_project.sh
Last active November 15, 2021 14:09
Create a trellis project from existing bedrock repos
#!/bin/sh
#change de URL of the repo
deployRepo=https://github.com/undefinedio/deveerman-trellis.git
bedrockRepo=https://github.com/undefinedio/deveerman-backend.git
tools=(trellis) #tool from roots.io
subtrees=(trellis) #folder structure for the tools
#init repo
@koraysels
koraysels / TRELLIS setup local + digialocean.md
Last active February 23, 2022 11:25
Use Trellis to deploy to digitalocean droplet
# install vagrant
brew install --cask vagrant

# install ansible
brew install ansible 
brew install esolitos/ipa/sshpass

# install virtualbox but make sure it is virtualbox v6.1.26 
@koraysels
koraysels / roland-dxy-1350.md
Last active May 8, 2023 00:17
Roland Plotter HPGL install guide for Mac
@koraysels
koraysels / web.config
Created March 7, 2016 13:33
web.config for Wordpress pretty Permalinks
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0"/>
</system.web>
<system.webServer>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
<dynamicTypes>
<add mimeType="text/css" enabled="true"/>
@koraysels
koraysels / deploy-ignore.txt
Last active September 30, 2015 07:45
deploy script via ssh & rsync with txt to ignore specific files
web/app/themes/stash/bower
web/app/uploads
.idea
.env
.bowerrc
bower.json
Capfile*
Gemfile*
deploy.sh
deploy-ignore.txt
@koraysels
koraysels / get current hostname even if behind ngix or apache (nodejs with express)
Last active August 29, 2015 14:20
When i wanted to het the current hostname of the application in nodejs I always got back ```localhost``` and not the real hostname.. This was because it was behind an Apache webserver :D solution below
var hostname = req.headers['x-forwarded-server'];
if (typeof hostname == "undefined") {
hostname = ( req.headers.host.match(/:/g) ) ? req.headers.host.slice(0, req.headers.host.indexOf(":")) : req.headers.host;
}

Fixing npm On Mac OS X for Homebrew Users

If you just want to fix the issue quickly, scroll down to the "solution" section below.

Explanation of the issue

If you're a Mac Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you will see an error like this:

$ npm update npm -g
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh