Skip to content

Instantly share code, notes, and snippets.

View andrewflash's full-sized avatar

Andri Rahmadhani andrewflash

  • Ciamis, Indonesia
View GitHub Profile
@andrewflash
andrewflash / supermarket.py
Created May 4, 2023 14:28
Supermarket Simulation in Python
# Function to display greetings and show some promotional items and its price
def display_greetings(name):
print(f"Welcome to {name} supermarket! Today's promotional items are:")
print("----------------------------------------------------------")
print()
# Function to display items
def display_items(msg, items):
print(f"{msg}")
print()
@andrewflash
andrewflash / using_fork.md
Created November 22, 2018 12:04
Using Fork

Clone your repo

git clone https://github.com/YOUR-USERNAME/Spoon-Knife
@andrewflash
andrewflash / hexToAscii.c
Created July 3, 2018 05:00
Hex string to Ascii string
void hexToAscii(char *inBuff, char *outBuff)
{
while(*inBuff)
{
unsigned int ch;
int n;
if ( sscanf(inBuff, "%2x%n", &ch, &n) != 1 )
{
break;
}
@andrewflash
andrewflash / Robot.ino
Created October 3, 2016 20:02
Ad-hoc network car Arduino code
#include <EEPROM.h>
#include "PacketSerial.h"
#define STARTBYTE 0xFF
#define PACKETSIZE 254
#define MINPACKET 8
#define TCP 1
#define ADHOC 0
#define FWD 0
#define ACK 1
7755 CELL_0 00:14:bf:70:22:ee -67
7757 CELL_0 74:29:af:22:91:52 -73
7757 CELL_0 00:1a:70:a0:01:3a -73
7757 CELL_0 66:27:37:19:15:0f -74
7757 CELL_0 76:29:af:22:91:53 -74
7757 CELL_0 54:88:0e:d2:eb:08 -74
7758 CELL_0 64:27:37:19:15:0e -76
7759 CELL_0 94:a7:b7:3d:8a:e4 -77
7759 CELL_0 b2:c2:87:2a:ab:0b -78
7759 CELL_0 c8:b3:73:5d:83:f5 -78
2908 NONE 00:14:bf:70:22:ee -64
2909 NONE 54:88:0e:d2:eb:08 -77
2909 NONE fa:8f:ca:9b:8a:de -81
2909 NONE 76:29:af:22:91:53 -72
2909 NONE 00:1a:70:a0:01:3a -69
2909 NONE 42:a5:89:3e:54:09 -74
2909 NONE 66:27:37:19:15:0f -77
2909 NONE 64:27:37:19:15:0e -77
2910 NONE c4:ea:1d:6c:c9:6d -77
2910 NONE c8:b3:73:5d:83:f5 -87
@andrewflash
andrewflash / php_mailer.php
Created November 23, 2013 05:32
Using PHP Mailer to Send HTML Emails with Images
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp1.example.com;smtp2.example.com";
$mail->SMTPAuth = true;
$mail->Username = 'smtpusername';
$mail->Password = 'smtppassword';
$mail->From="mailer@example.com";
@andrewflash
andrewflash / check_uploaded_file.php
Created November 23, 2013 05:29
The Real Way to Check Uploaded File Type
<?php
// Here we specify all the type of files we want to accept
$extension = array("application/pdf", "image/jpeg", "image/png", "image/gif");
if(isset($_POST['submit'])){
exec("file -i ".$_FILES['inputName']['tmp_name'], $output);
$type = explode(':', (string)$output[0]);
}
// Here we check our file with our needs
@andrewflash
andrewflash / css_resources.md
Created November 23, 2013 05:26 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@andrewflash
andrewflash / javascript_resources.md
Created November 23, 2013 05:26 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage