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 / wifi_rpimonitord
Created October 2, 2013 16:44
Add a WiFi icon to the RPi-Monitor status page. Since I use a WiFi adapter with my raspberry pi and not an ethernet cable, it makes sense to be able to monitor WiFi bandwidth and speed. [sudo nano /etc/rpimonitord.conf.d/default.conf] and add the following at the end of the file.
###############################################################
# Graph WLAN
###############################################################
dynamic.17.name=wifi_received
dynamic.17.source=/sys/class/net/wlan0/statistics/rx_bytes
dynamic.17.regexp=(.*)
dynamic.17.postprocess=$1*-1
dynamic.17.rrd=DERIVE
dynamic.18.name=wifi_send
@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>
)
}
@aamnah
aamnah / redux-basics.js
Created December 2, 2016 08:33
Basic Redux functions
// define a reducer
const reducer = function(state, action) {
if (action.type === 'INC') {
return state + action.payload
} else if (action.type === 'DEC') {
return state - action.payload
}
return state
}
@aamnah
aamnah / htaccess.txt
Created December 3, 2016 14:20
.htaccess template
# .htaccess template
# http://www.htaccesseditor.com/en.shtml#a_extension
# Default page
# (in order of first specified)
###############
DirectoryIndex index.html index.php
# Enable Rewrites
@aamnah
aamnah / php.ini.txt
Created December 3, 2016 14:21
php.ini template
; the following three settings limit the maximum size of data that can be submitted and handled by PHP
; One user also said that post_max_size and memory_limit need to be larger than upload_max_filesize.
post_max_size = 128M
memory_limit = 128M
upload_max_filesize = 64M ; e.g. when importing databases, general file uploads
@aamnah
aamnah / _variables.scss
Created December 3, 2016 14:23
Sass Variables
// $Font Variables
$font-body: 'Open Sans', Tahoma, sans-serif;
$font-headings: 'Brandon Grotesque', Georgia, serif;
$font-code: Consolas, Monaco, Lucida Console, monospace;
// $Color Variables
$color-brand-pink: #F17B91;
$color-brand1: #F599C0;
$color-brand2: #59CBF5;