Skip to content

Instantly share code, notes, and snippets.

View aamnah's full-sized avatar
💭
the learning never stops

Aamnah aamnah

💭
the learning never stops
View GitHub Profile
@aamnah
aamnah / oc.sh
Last active November 27, 2015 20:26
Bash script for OC install
#!/bin/bash
###
# Author: Aamnah
# Link: http://aamnah.com
# Description: Install script for Opencart 2.x on a Linux (Ubuntu/Debian) server
###
# Color Reset
Color_Off='\033[0m' # Text Reset
@aamnah
aamnah / index.html
Created October 28, 2015 14:07
Realtime JavaScript clock
<div id="time"></div>
@aamnah
aamnah / play.html
Last active October 28, 2015 20:45
play audio when clicked
<!-- image -->
<a href="javascript:play('dog')"><img src="img/dog.png"></img></a>
<!-- link -->
<a href="javascript:play('dog')">Dog</a>
<!-- audio file -->
<audio
id="dog"
src="media/dog.wav"
@aamnah
aamnah / oc_secure_perms_2.0.1.0
Last active September 8, 2022 15:23
Opencart Secure Permissions (after install)
# delete install folder
if [ -d "install/" ]; then
rm -rf install
fi
# To change all the directories to 755 (-rwxr-xr-x)
find . -type d -exec chmod 755 {} \;
# To change all the files to 644 (-rw-r--r--):
find . -type f -exec chmod 644 {} \;
@aamnah
aamnah / mysql_backup.sh
Created June 18, 2016 08:19
A simple script that dumps compressed mysql databases individually with a timestap
#!/bin/bash
USER='BACKUPUSER'
PASSWORD='PASSWORD'
DIR='/backups/mysql' # don't use the trailing slash as it is used in the command
# see `date --help` for format controls
# %b = Jan
# $H = hour (00..23)
# %M = minute (00..59)
@aamnah
aamnah / picamera.py
Last active August 7, 2016 19:43
Take a picture using the picamera library and a python script
# SOURCE: https://www.youtube.com/watch?v=t5laKVNJd8U
# INSTALL: sudo apt-get install python3-picamera
# the tutorial used a Pi NoIR camera
# DOCS: https://www.raspberrypi.org/documentation/usage/camera/python/README.md
import picamera
# setup the camera such that it closes
# when we are done with it
print("About to take a picture. CHEESE!")
@aamnah
aamnah / fswebcam.sh
Created August 8, 2016 14:02
Take a picture with fswebcam
#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H%M")
# TODO: if dir doen't exits mkdir
fswebcam -r 1280x720 --no-banner /home/pi/webcam/$DATE.jpg
# run: ./fswebcam.sh
@aamnah
aamnah / nodemcu_connect_wifi.lua
Created August 9, 2016 03:36
connect to WiFi on NodeMCU
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","password")
print(wifi.sta.getip())
@aamnah
aamnah / reducers-actions.jsx
Created November 29, 2016 11:23
REDUX: Reducers and Actions
// Libs
import {createStore} from 'redux'
// STORE
// .createStore(reducer, [preloadedState], [enhancer])
// .createStore(function(state, action) {})
// let's you create a store that holds the complete state tree of your app. there should only be a signle store in your app
const store = createStore(function(state, action) {
// make a change to the state based on the action
@aamnah
aamnah / pure-component.jsx
Last active November 29, 2016 12:43
React Pure Component function
const App = (props) => {
return (
// code goes here
<div>
<p>My name is {props.name}. I am {props.age} years old.</p>
</div>
)
}