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
@Elements-
Elements- / getMP4Length.js
Created March 26, 2016 18:32
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);
### 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
@odan
odan / xampp_php7_xdebug.md
Last active April 17, 2024 05:36
Installing Xdebug for XAMPP
@sjelfull
sjelfull / Installing Imagick with PHP 7.md
Last active March 28, 2020 05:37
Installing Imagick with PHP 7

1. Download the phpseven branch of the imagick repository

git clone https://github.com/mkoppanen/imagick.git imagick

2. phpize for target PHP version

cd imagick && /path/to/php7/bin/phpize && ./configure && make && make install

3. Enable the extension for your PHP version

@0XDE57
0XDE57 / config.md
Last active April 18, 2024 04:36
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Latest Version: https://gist.github.com/quill18/5a7cfffae68892621267
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2015-04-16: Changed Pool to use a Stack generic.
///
/// Usage:
///
@GuilleUCM
GuilleUCM / SmoothFollow2D
Created April 2, 2015 09:46
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;
@feklee
feklee / README.md
Last active April 24, 2019 16:38
Notes and experiments concerning HTML5 streaming, with an emphasis on live streaming

Introduction

Collection of solutions for streaming via DASH, Dynamic Adaptive Streaming over HTTP, as of November 2014.

Recommended client: Chrome 38

Tool used for encoding live streams: FFmpeg

@gabrielemariotti
gabrielemariotti / MainActivity.java
Last active February 15, 2021 17:32
How to obtain a CardView (support library) with a Image and rounded corners for API<21
ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image);
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
//Default
imageView.setBackgroundResource(R.drawable.rose);
} else {
//RoundCorners
RoundCornersDrawable round = new RoundCornersDrawable(mBitmap,
getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius
@alexdlaird
alexdlaird / daemon.cpp
Last active April 7, 2024 16:54
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>