Skip to content

Instantly share code, notes, and snippets.

View amitkhare's full-sized avatar
🤔
Brainstorming

Amit Kumar Khare amitkhare

🤔
Brainstorming
View GitHub Profile
private System.Threading.Timer timer;
private void SetUpTimer(TimeSpan alertTime)
{
DateTime current = DateTime.Now;
TimeSpan timeToGo = alertTime - current.TimeOfDay;
if (timeToGo < TimeSpan.Zero)
{
return;//time already passed
}
this.timer = new System.Threading.Timer(x =>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace amitkhare
{
struct Float2
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace amitkhare
{
class W3DGraph
@amitkhare
amitkhare / TwitterHelper.cs
Last active March 16, 2020 11:45
TwitterHelper API
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Collections.Generic;
using System.Windows.Forms;
namespace TwitterHelper
{
public class Twitter
@amitkhare
amitkhare / TextCounter.cs
Last active March 24, 2020 09:50
UserControl for Counting text of given textbox
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
@amitkhare
amitkhare / CityList.json
Last active April 3, 2020 08:10
Indian City List for Forecast
[
{ "order_index": -2, "forecast" : [], "updated_at": "", "city" : "Amravati" , "state" : "Andhra Pradesh" , "imd" : "99961", "ow": "" , "city_hindi": "अमरावती" , "city_urdu": "", "state_hindi": "आंध्र प्रदेश", "state_urdu": "" },
{ "order_index": 0, "forecast" : [], "updated_at": "", "city" : "Itanagar" , "state" : "Arunachal Pradesh" , "imd" : "42308", "ow": "" , "city_hindi": "ईटानगर" , "city_urdu": "", "state_hindi": "अरुणाचल प्रदेश", "state_urdu": "" },
{ "order_index": 0, "forecast" : [], "updated_at": "", "city" : "Dispur" , "state" : "Assam" , "imd" : "99979", "ow": "1272508", "city_hindi": "दिसपुर" , "city_urdu": "", "state_hindi": "असम", "state_urdu": "" },
{ "order_index": 0, "forecast" : [], "updated_at": "", "city" : "Patna" , "state" : "Bihar" , "imd" : "42492", "ow": "1260086", "cit
@amitkhare
amitkhare / .rtorrent.rc
Created April 9, 2020 20:27
sample rtorrent.rc file with move on complete
# Where rTorrent saves the downloaded files
directory= /srv/torrent/downloads
# Where rTorrent saves the session
session.path.set = /srv/torrent/.session
# Which ports rTorrent can use (Make sure to open them in your router)
network.port_range.set = 50000-50000
network.port_random.set = no
var inX = 0; // -100 to +100;
var inY = 0; // -100 to +100;;
var inZ = 0; // -100 to +100;
var inW = 100; // 0 to 100;
var inH = 100; // 0 to 100;
var areaW = d; // out Width range
var areaH = e; // out Height range
#!/bin/sh
dirbase="/var/www/"
# cd $dirbase
read -p "Current Directory as base?(y/N) " isCurrDir
if [ "$isCurrDir" = "Y" ] || [ "$isCurrDir" = "y" ]; then
dirpath=$(pwd)
@amitkhare
amitkhare / node_nginx_ssl.md
Created May 6, 2020 06:48 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user