Skip to content

Instantly share code, notes, and snippets.

View mzkaramat's full-sized avatar
📸
FotoNow

Zeeshan Karamat mzkaramat

📸
FotoNow
View GitHub Profile
#!/usr/bin/env bash
set -e
cd
case "$OSTYPE" in
darwin*) DOWNLOAD=https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh ;;
linux*) DOWNLOAD=https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh ;;
*) echo "unknown: $OSTYPE" ;;
esac
@mzkaramat
mzkaramat / AdjustedExposureImage.swift
Created August 28, 2020 13:30 — forked from Jesse-calkin/AdjustedExposureImage.swift
UIImage extension for creating a new image with adjusted exposure
extension UIImage {
/**
Returns a new `UIImage` with an adjusted exposure value.
- Parameter ev: The amount to adjust the exposure value. Negative for darker, positive for lighter.
- Returns: a new `UIImage` with an adjusted exposure value.
*/
func imageWithAdjustedExposure(ev: Double) -> UIImage? {
guard let cgImage = self.CGImage else { return nil }
@mzkaramat
mzkaramat / JavaScriptRepeat.js
Created February 20, 2020 21:46 — forked from KartikTalwar/JavaScriptRepeat.js
Make a JavaScript function repeat every x seconds
function refreshData()
{
x = 5; // 5 Seconds
// Do your thing here
setTimeout(refreshData, x*1000);
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@mzkaramat
mzkaramat / clustering-time-series-data.R
Created July 8, 2018 21:11
Clustering Time Series Data
library(quantmod)
symbols = c('A', 'AAPL', 'ADBE', 'AMD', 'AMZN', 'BA', 'CL', 'CSCO', 'EXPE', 'FB', 'GOOGL',
'GRMN', 'IBM', 'INTC', 'LMT', 'MSFT', 'NFLX', 'ORCL', 'RHT', 'YHOO')
start = as.Date("2014-01-01")
until = as.Date("2014-12-31")
# Grab data, selecting only the Adjusted close price.
#
stocks = lapply(symbols, function(symbol) {
@mzkaramat
mzkaramat / remove-big-file.sh
Created May 23, 2018 10:38 — forked from BrunoGrandePhD/remove-big-file.sh
Remove a large committed file from your Git repository.
# The commands below are a guide to remove a large file that has been
# accidentally committed to a Git repository's history. If the file is
# larger than 100 MB, GitHub will prevent you from pushing your latest
# commits. The annotated steps below should help you remove the large
# file from your commit history, even if you've made new commit since.
# Some Git users advise against rebasing. You can safely use it here
# because you haven't published your changes yet.
# So, you first need to rebase your current branch onto the point that
@mzkaramat
mzkaramat / tmux-cheatsheet.markdown
Created December 5, 2017 13:08 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mzkaramat
mzkaramat / sed-cheatsheet.md
Created October 24, 2017 15:19 — forked from sergeyklay/sed-cheatsheet.md
Sed Cheatsheet

Sed Cheat Sheet

Sed command line options

sed [options] sed-command [input-file]
Option Description Example
@mzkaramat
mzkaramat / JS-LINQ.js
Created October 1, 2017 06:59 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }