Skip to content

Instantly share code, notes, and snippets.

View enisinanaj's full-sized avatar
🎯
Focusing

Eni Sinanaj enisinanaj

🎯
Focusing
View GitHub Profile
/**
* Return a table string representation of the matrix
* @param {Array} matrix The matrix
* @param {String} prop The property to print
*/
function stringifyMatrix(matrix, prop = "originalValue") {
return matrix
.map((e) => e.map((e) => (prop === "" ? String(e) : e[prop])))
.join("\n")
.replace(/\,/g, " ");
@kopiro
kopiro / README.md
Created June 22, 2018 11:48
Download entire INTERNET

Internet Downloader

Simple POC

Compilation

brew install wget
gcc -lcurl download_internet.c
@amanualt
amanualt / ELK.md
Last active May 29, 2023 10:21
Elasticsearch, Logstash, Kibana, Centos 7, Firewalld

Install ELK(Elasticsearch, Logstatsh, and Kibana) on Centos 7

Install java 1.8

  • download and install java
cd /opt
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jre-8u102-linux-x64.rpm"
rpm -Uvh jre-8u102-linux-x64.rpm
import org.sonatype.nexus.repository.storage.StorageFacet;
import org.sonatype.nexus.repository.storage.Query;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
def fmt = DateTimeFormat.forPattern('yyyy-MM-dd HH:mm:ss');
// Get a repository
def repo = repository.repositoryManager.get('nuget-releases');
// Get a database transaction
def tx = repo.facet(StorageFacet).txSupplier().get();
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active May 4, 2024 14:06
React Native Bridging Cheatsheet
@toddhopkinson
toddhopkinson / BackgroundTransferSample.swift
Last active September 27, 2023 01:47
Upload Very Large Files In Background on iOS - Alamofire.upload multipart in background
// You have a very very large video file you need to upload to a server while your app is backgrounded.
// Solve by using URLSession background functionality. I will here use Alamofire to enable multipart upload.
class Networking {
static let sharedInstance = Networking()
public var sessionManager: Alamofire.SessionManager // most of your web service clients will call through sessionManager
public var backgroundSessionManager: Alamofire.SessionManager // your web services you intend to keep running when the system backgrounds your app will use this
private init() {
self.sessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default)
self.backgroundSessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.background(withIdentifier: "com.lava.app.backgroundtransfer"))
@narendra-r
narendra-r / video_alasset.swift
Last active June 18, 2019 22:55
Read video data from video URl in Swift
import Photos
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
self.dismissViewControllerAnimated(true, completion: nil)
if let referenceURL = info[UIImagePickerControllerReferenceURL] as? NSURL {
let fetchResult = PHAsset.fetchAssetsWithALAssetURLs([referenceURL], options: nil)
if let phAsset = fetchResult.firstObject as? PHAsset {
PHImageManager.defaultManager().requestAVAssetForVideo(phAsset, options: PHVideoRequestOptions(), resultHandler: { (asset, audioMix, info) -> Void in
if let asset = asset as? AVURLAsset {
@alexanderbartels
alexanderbartels / web.xml
Created September 24, 2015 16:06
web.xml to with mime type for web fonts
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Web-Fonts</display-name>
<!-- web fonts -->
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
@giraam
giraam / string-to-sha1.java
Last active May 17, 2023 17:55
Hashing a String with SHA1 in Java
import java.io.*;
import java.util.logging.*;
import javax.xml.bind.DatatypeConverter;
/**
* Hashing with SHA1
*
* @param input String to hash
* @return String hashed
*/
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: