Skip to content

Instantly share code, notes, and snippets.

Avatar
🚵‍♂️
Road to 2024

Muhaimin CS muhaimincs

🚵‍♂️
Road to 2024
  • MCS Dev Resources
  • Puchong, Selangor
View GitHub Profile
@cancerberoSgx
cancerberoSgx / rmnodemodules.sh
Last active March 23, 2023 13:51
remove node_modules and package-lock.json recursively
View rmnodemodules.sh
find . -name "node_modules" -exec rm -rf '{}' +; find . -name "package-lock.json" -exec rm -rf '{}' +;
@superjose
superjose / .gitlab-ci.yml
Last active April 19, 2023 11:11
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
View .gitlab-ci.yml
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.
@kidGodzilla
kidGodzilla / mailthisto-ajax-example.js
Last active April 26, 2023 19:57
MailThis.to Ajax Example
View mailthisto-ajax-example.js
// The following example POSTS data to mailthis.to, redirects the user to a confirmation page, and then sends an email (upon the successful completion of Recaptcha verification)
$.post('https://mailthis.to/test@example.com', {
email: 'foo@bar.co',
_subject: 'hi!',
message: 'Test'
}).then(function () {
location.href = 'https://mailthis.to/confirm'
});
@davideicardi
davideicardi / mongo-docker.bash
Last active March 12, 2023 21:47
Running mongodb inside a docker container (with mongodb authentication)
View mongo-docker.bash
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@xinan
xinan / material-theme.itermcolors
Created August 1, 2015 16:18
Material Theme iTerm2 Port
View material-theme.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.25882352941176467</real>
<key>Green Component</key>
<real>0.21176470588235294</real>
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active May 5, 2023 03:11
How to set up stress-free SSL on an OS X development machine
View how-to-set-up-stress-free-ssl-on-os-x.md

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@NARKOZ
NARKOZ / db_backup.sh
Created October 23, 2010 18:15
MySQL backup shell script
View db_backup.sh
#!/bin/bash
# Shell script to backup MySQL database
# Set these variables
MyUSER="" # DB_USERNAME
MyPASS="" # DB_PASSWORD
MyHOST="" # DB_HOSTNAME
# Backup Dest directory
DEST="" # /home/username/backups/DB