Skip to content

Instantly share code, notes, and snippets.

View wmucheru's full-sized avatar
💭
AI?

wmucheru

💭
AI?
View GitHub Profile
@mrbar42
mrbar42 / README.md
Last active August 26, 2024 14:05
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@IvBaranov
IvBaranov / AndroidImageAdapter.java
Last active June 11, 2019 19:44
Android quick image fullscreen slider
public class AndroidImageAdapter extends PagerAdapter {
Context mContext;
AndroidImageAdapter(Context context) {
this.mContext = context;
}
@Override
public int getCount() {
return sliderImagesId.length;
@pradeep1991singh
pradeep1991singh / index.android.ios.js
Last active October 30, 2020 14:44
Example AsyncStorage React Native
/**
* Example AsyncStorage React Native
* https://github.com/pradeep1991singh
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
@stevenengland
stevenengland / Signal2Channel.mq4
Last active February 28, 2024 18:13
Sample implementation: How to send trading signals from Metatrader to Telegram channel/group/private chat with Telegram4MQL
//+------------------------------------------------------------------+
//| Signal2Channel.mq4 |
//| steven england |
//| https://Telegram4MQL.steven-england.info |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| !!! Please note that there is a successor project. !!! |
//| Visit https://mmm.steven-england.info or |
//| https://github.com/stevenengland/MMM for more information |
@stremsdoerfer
stremsdoerfer / swiftHTTPPOST.swift
Last active December 22, 2017 10:18
POST request example in Swift
var request = URLRequest(url:URL(string:"http://localhost:8888/login")!)
request.httpMethod = "POST"
let params = ["email":"name@mail.com", "password":"password"]
request.httpBody = try? JSONSerialization.data(withJSONObject: params, options: [])
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
URLSession.shared.dataTask(with: request) { (data:Data?, response:URLResponse?, error:Error?) in
if let safeData = data{
print("response: \(String(data:safeData, encoding:.utf8))")
@bsara
bsara / git-ssh-auth-win-setup.md
Last active September 6, 2024 05:43
Setup SSH Authentication for Git Bash on Windows

Setup SSH Authentication for Git Bash on Windows

Prepararation

  1. Create a folder at the root of your user home folder (Example: C:/Users/uname/) called .ssh.
  2. Create the following files if they do not already exist (paths begin from the root of your user home folder):
  • .ssh/config
@arthtilva
arthtilva / download.java
Last active March 21, 2023 12:15
DownloadManager - download files using DownloadManager
public class NewsDetailActivity extends AppCompatActivity implements View.OnClickListener {
Activity activity;
Toolbar toolbar;
File TEMP_FILE_SAVE_PATH = Environment.getExternalStorageDirectory();
String TEMP_FILE_NAME = "news_";
String URL="";
private DownloadManager downloadManager;
@Override
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active September 7, 2024 14:29
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@benwells
benwells / reduce-example.js
Created May 12, 2016 13:40
Using Array.reduce to sum a property in an array of objects
var accounts = [
{ name: 'James Brown', msgCount: 123 },
{ name: 'Stevie Wonder', msgCount: 22 },
{ name: 'Sly Stone', msgCount: 16 },
{ name: 'Otis Redding', msgCount: 300 } // Otis has the most messages
];
// get sum of msgCount prop across all objects in array
var msgTotal = accounts.reduce(function(prev, cur) {
return prev + cur.msgCount;
@DeepakRattan
DeepakRattan / Bean.java
Created March 29, 2016 11:00
Filtering ListView using Filterable interface
package com.almabay.filterlistdemo;
/**
* Created by deepakr on 3/29/2016.
*/
public class Bean {
String name, age;
public Bean(String name, String age) {
this.name = name;