Skip to content

Instantly share code, notes, and snippets.

View AfvanMoopen's full-sized avatar
😃
Focusing

Afvan AfvanMoopen

😃
Focusing
View GitHub Profile
ip_address="1.2.3.4"
from_user="someone@foobar.com"
to_user="user@foobar.com"
smtp_host="gogogo.gogo.com"
smtp_user="someone@foobar.com"
smtp_password="nomention"
df -h | grep -E "(Filesystem|sda)" | mail -S smtp-auth-user=${smtp_user} -S smtp-auth-password=${smtp_password} -S smtp=${smtp_host} -s "[LOG] ${ip_address} Disk Usage Report $(date +\%y/\%m/\%d)" -r ${from_user} -c ${to_user} ${to_user}
# cat msg | mail -b "bcc_user@foobar.com" -s "Email" "user@foobar.com"
ip_address="1.2.3.4"
from_user="someone@foobar.com"
to_user="user@foobar.com"
smtp_host="gogogo.gogo.com"
smtp_user="someone@foobar.com"
smtp_password="nomention"
df -h | grep -E "(Filesystem|sda)" | mail -S smtp-auth-user=${smtp_user} -S smtp-auth-password=${smtp_password} -S smtp=${smtp_host} -s "[LOG] ${ip_address} Disk Usage Report $(date +\%y/\%m/\%d)" -r ${from_user} -c ${to_user} ${to_user}
# cat msg | mail -b "bcc_user@foobar.com" -s "Email" "user@foobar.com"
Contribute to a project
If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.
How to make a clean pull request
Look for a project's contribution instructions. If there are any, follow them.
Create a personal fork of the project on Github.
Clone the fork on your local machine. Your remote repo on Github is called origin.
Add the original repository as a remote called upstream.
If you created your fork a while ago be sure to pull upstream changes into your local repository.
#include <stdio.h>
#include <GL/glut.h>
int x = 50, y = 50;
bool isBlack = true;
void whiteBox(int x, int y)
{
glBegin(GL_LINE_LOOP);
glVertex2i(x, y);
#!/usr/bin/env ruby
loop do
printing = false
driver_pid = nil
`ps aux | grep -i [d]ymo`.split(/\n/).each do |line|
parts = line.split
user = parts[0]
pid = parts[1]
#include<iostream>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
using namespace std;
int main()
{
float a,b,c;
# precede each line by its line number FOR THAT FILE (left alignment).
# Using a tab (\t) instead of space will preserve margins.
awk '{print FNR "\t" $0}' files*
# precede each line by its line number FOR ALL FILES TOGETHER, with tab.
awk '{print NR "\t" $0}' files*
# number each line of a file (number on left, right-aligned)
# Double the percent signs if typing from the DOS command prompt.
awk '{printf("%5d : %s\n", NR,$0)}'
import java.awt.*;
import java.util.Date;
import http.requests.*;
PImage cursor;
PGraphics canvas;
Robot robot;
MousePoint mouse, pmouse;
using Gtk
win = GtkWindow("Calculator")
b1 = GtkButton("1")
b2 = GtkButton("2")
b3 = GtkButton("3")
b_plus = GtkButton("+")
b4 = GtkButton("4")
b5 = GtkButton("5")
def preceptron(X, y, lr, epochs):
m,n = X.shape
theta = np.zeros((n+1, 1))
n_miss_list = []
for epoch in range(epochs):
n_miss = 0
for idx, x_i in enumerate(X):
x_i = np.insert(x_i, 0, 1).reshape(-1, 1)
y_hat = step_func(np.dot(x_i.T, theta))
if (np.squeeze(y_hat) - y[idx]) != 0: