Skip to content

Instantly share code, notes, and snippets.

View aameralduais's full-sized avatar
😁
Happily coding!

Aamer Alduais aameralduais

😁
Happily coding!
  • Sana'a, Yemen
View GitHub Profile
@aameralduais
aameralduais / SmoothFollow2D
Created August 6, 2017 15:46 — forked from GuilleUCM/SmoothFollow2D
Unity:Camera:Smooth Follow 2D
using UnityEngine;
using System.Collections;
public class SmoothFollow2D : MonoBehaviour {
//offset from the viewport center to fix damping
public float m_DampTime = 10f;
public Transform m_Target;
public float m_XOffset = 0;
public float m_YOffset = 0;
@aameralduais
aameralduais / daemon.cpp
Created August 24, 2017 07:45 — forked from alexdlaird/daemon.cpp
Useful as a starting point for a C++ based Linux daemon application.
#include <dirent.h>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <sys/stat.h>
#include <syslog.h>
@aameralduais
aameralduais / inotify-example.cpp
Created August 30, 2017 18:18 — forked from pkrnjevic/inotify-example.cpp
This simple inotify sample monitors changes to "./tmp". Recursive monitoring of file and directory create and delete events is implemented, but monitoring pre-existing "./tmp" subfolders is not. A C++ class containing a couple of maps is used to simplify monitoring. The Watch class is minimally integrated, so as to leave the main inotify code ea…
//
// File: inotify-example.cpp
// Date: July 16, 2013
// Author: Peter Krnjevic <pkrnjevic@gmail.com>, on the shoulders of many others
//
// This is a simple inotify sample program monitoring changes to "./tmp" directory (create ./tmp beforehand)
// Recursive monitoring of file and directory create and delete events is implemented, but
// monitoring pre-existing "./tmp" subfolders is not.
// A C++ class containing a couple of maps is used to simplify monitoring.
// The Watch class is minimally integrated, so as to leave the main inotify code
@aameralduais
aameralduais / getMP4Length.js
Created October 11, 2017 08:40 — forked from Elements-/getMP4Length.js
Read the duration of a mp4 file nodejs
var buff = new Buffer(100);
fs.open(file, 'r', function(err, fd) {
fs.read(fd, buff, 0, 100, 0, function(err, bytesRead, buffer) {
var start = buffer.indexOf(new Buffer('mvhd')) + 17;
var timeScale = buffer.readUInt32BE(start, 4);
var duration = buffer.readUInt32BE(start + 4, 4);
var movieLength = Math.floor(duration/timeScale);
console.log('time scale: ' + timeScale);
console.log('duration: ' + duration);
@aameralduais
aameralduais / pngHeaderInformation.js
Created October 11, 2017 08:42 — forked from Elements-/pngHeaderInformation.js
Get PNG header information from an image (width, height, bit depth, and color type)
var fs = require('fs');
fs.readFile('test.png', function (err, data) {
var pngHeader = new Buffer([137, 80, 78, 71, 13, 10, 26, 10]);
var header = data.slice(0, 8);
if(header.compare(pngHeader) != 0) {
console.log('Invalid png file header!')
process.exit();
}
var fileHeader = {
@aameralduais
aameralduais / OtpAuthenticator.cs
Created January 18, 2018 20:44 — forked from BravoTango86/OtpAuthenticator.cs
C# OTP Implementation with TOTP and HOTP
/*
* Copyright (C) 2016 BravoTango86
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@aameralduais
aameralduais / remove-win-10-apps.md
Created April 13, 2018 12:47 — forked from magnusbae/remove-win-10-apps.md
How to remove Windows 10 Apps (eg. "Photos")

How to remove Windows 10 Apps (eg. "Photos")

Open PowerShell (right click > run as Administrator), and enter Get-AppxPackage *photo* | Remove-AppxPackage For other apps just replace "photo" with something else.

If you want to look at the list of installed applications just use Get-AppxPackage, if you want to copy said list into a program better suited for working with text (eg. has search), just type Get-AppxPackage | clip

@aameralduais
aameralduais / Ubuntu_1604_flectra_1_0_installation.sh
Created April 18, 2018 07:35
Install Flectra 1.0 On Ubuntu 16.04 LTS
#!/bin/bash
sudo adduser --system --quiet --shell=/bin/bash --home=/opt/flectra --gecos 'flectra' --group flectra
sudo mkdir /etc/flectra && sudo mkdir /var/log/flectra/
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install postgresql postgresql-server-dev-9.5 build-essential python3-pillow python3-lxml python-ldap3 python3-dev python3-pip python3-setuptools npm nodejs git gdebi libldap2-dev libsasl2-dev libxml2-dev libxslt1-dev libjpeg-dev zlib1g-dev -y
sudo git clone --depth=1 --branch=1.0 https://github.com/flectrahq/flectra.git /opt/flectra/flectra
sudo chown flectra:flectra /opt/flectra/ -R && sudo chown flectra:flectra /var/log/flectra/ -R && cd /opt/flectra/flectra && sudo pip3 install -r requirements.txt
sudo npm install -g less less-plugin-clean-css -y && sudo ln -s /usr/bin/nodejs /usr/bin/node
cd /tmp && wget https://downloads.wkhtmltopdf.org/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb && sudo gdebi -n wkhtmltox-0.12.2.1_linux-trusty-amd64.deb && rm wkhtmltox-0.12.2.1_l
@aameralduais
aameralduais / README.md
Created April 20, 2018 08:30 — forked from hofmannsven/README.md
My simply Git Cheatsheet
### SSL Part 1: Creating Java SSL KeyStore (JKS)
This is part one of a three-part series on how to configure a single SSL certificate for use on both Tomcat and Apache. I'll take you through creating a new Java KeyStore (JKS), submitting a Certificate Signing Request (CSR), and finally, importing the singed certificate into your KeyStore.
#### 1\. First, create a directory for your SSL files
# sudo mkdir /etc/my_ssl
#### 2\. Now change into that directory