Skip to content

Instantly share code, notes, and snippets.

View mskian's full-sized avatar
🦕
Focusing

Santhosh Veer mskian

🦕
Focusing
View GitHub Profile
@mskian
mskian / livecricketscore.sh
Last active April 7, 2018 12:50 — forked from arulrajnet/livecricketscore.sh
Shell script to get a Live cricket score from www.espncricinfo.com. Just run this shellscript then select your match. when ever you want to know score open that terminal and see. Just simple as Dhoni's helicopter shot :D
#!/bin/bash
# -----------------------------------------------------------------------------
# Info:
# author: Arulraj <https://arulraj.net/>
# Modified by Santhosh veer <https://santhoshveer.com>
# file: score.sh
# Orginal Gist: https://gist.github.com/arulrajnet/fb71169c35180f9d9abd
# Modified Gist: https://gist.github.com/mskian/1e660a1a205a3b69e698cb0b0256b083
# created: 24.03.2015
@mskian
mskian / install-postman.sh
Last active July 1, 2024 17:42 — forked from aviskase/Postman.desktop
Install Postman on Ubuntu via Shell script
#!/bin/bash
cd /tmp || exit
echo "Downloading Postman ..."
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz
tar -xzf postman.tar.gz
rm postman.tar.gz
echo "Installing to opt..."
if [ -d "/opt/Postman" ];then
sudo rm -rf /opt/Postman
@mskian
mskian / async-await.js
Created September 4, 2018 15:43 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@mskian
mskian / es7-async-await.js
Created September 28, 2018 06:57 — forked from msmfsd/es7-async-await.js
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@mskian
mskian / createBearerToken.js
Created September 30, 2018 13:28 — forked from iamdtang/createBearerToken.js
A Javascript file that requests a Twitter bearer token for application only authentication (https://dev.twitter.com/docs/auth/application-only-auth). Depends on mikeals request library (https://github.com/mikeal/request) (npm install request)
var request = require("request");
var key = process.env.TWITTER_CONSUMER_KEY;
var secret = process.env.TWITTER_CONSUMER_SECRET;
var cat = key + ":" + secret;
var credentials = new Buffer(cat).toString('base64');
var url = 'https://api.twitter.com/oauth2/token';
request({
@mskian
mskian / scrape_medium.py
Created September 30, 2018 13:28 — forked from yurivictor/scrape_medium.py
Scrape your @Medium post links into HTML list, if you want to add them to your site, or whatever
import requests
from pyquery import PyQuery as pq
USERNAME = 'ev' # change to your username
def get_medium_posts():
url = 'http://medium.com/@' + USERNAME + '/latest'
request = requests.get( url )
html = request.content
@mskian
mskian / post-mortem.md
Created December 19, 2018 17:46 — forked from joewiz/post-mortem.md
Recovery from nginx "Too many open files" error on Amazon AWS Linux

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files) 2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

    • Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depending on your system.)
  1. Added fs.file-max = 70000 to /etc/sysctl.conf
  2. Added `nginx soft nofile 1
@mskian
mskian / linebreak.md
Created January 3, 2019 05:25
Line breaks in markdown
Hello  (<-- two spaces)
World

Hello
World


@mskian
mskian / repo-reset.md
Created May 2, 2019 10:24 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@mskian
mskian / .htaccess
Created March 26, 2020 11:49 — forked from conormcafee/.htaccess
Jekyll .htaccess for Apache Server
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)/$ $1.html [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*[^/]$ %{REQUEST_URI}/ [L,R=301]
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml