Skip to content

Instantly share code, notes, and snippets.

@ishu3101
ishu3101 / loop_string.pl
Created June 7, 2016 00:53
3 ways to loop through each character in a string in Perl
# 3 ways to loop through each character in a string
$text = "hello world";
for $i (0..length($text)-1){
$char = substr($text, $i, 1);
print "Index: $i, Text: $char \n";
}
foreach $char (split //, $text) {
@ishu3101
ishu3101 / multiple_value_dictionary.cs
Last active January 16, 2021 22:14
Dictionary with Single Key and Multiple Values Example in C#. See https://repl.it/CY3S/1 to run example code online.
using System;
using System.Collections.Generic;
class MainClass {
public static void Main (string[] args) {
Dictionary<string, List<String>> map = new Dictionary<string, List<String>>();
// create list one and store values
List<string> valSetOne = new List<string>();
@ishu3101
ishu3101 / imessage_charge.txt
Last active February 25, 2023 06:31
Why do you get charged every time for Activating iMessage or Facetime.
For iMessage/Facetime to activate after SIM change, iOS update or iMessage off/on,
iOS would be trying to send a background international TXT to the UK +44 (is 31c/SMS on prepay).
This is for Apple to validate the mobile number as yours so that people can't spoof your mobile number
and pretend to be you through iMessage/Facetime.
iMessages themselves are of course, not charged at all by Vodafone per message,
iMessages only use a relatively small ammount of internet data be that mobile or WiFi at home or whatever.
Taken from: https://community.vodafone.co.nz/t5/iPhone-iPad/HELP-text-message-and-Imessage-issues/td-p/124287
@ishu3101
ishu3101 / embed_ifttt.rst
Created April 22, 2016 02:53
Embed IFTTT Recipe in reStructuredText
https://ifttt.com/recipe_embed_img/13409 https://ifttt.com/recipe_embed_img/376877 https://ifttt.com/recipe_embed_img/104102 https://ifttt.com/recipe_embed_img/231325 https://ifttt.com/recipe_embed_img/89597
@ishu3101
ishu3101 / embed_ifttt.textile
Created April 22, 2016 02:45
Embed IFTTT Recipes in Textile

IFTTT Recipe:

IFTTT Recipe:

IFTTT Recipe:
IFTTT Recipe:

IFTTT Recipe:

@ishu3101
ishu3101 / sync_gitbranch.sh
Created February 24, 2016 05:33
Git: Keep gh-pages branch up to date (sync) with the master branch
git add .
# see what changes are going to be commited
git status
git commit -m 'Some descriptive commit message'
git push origin master
# go to the gh-pages branch
git checkout gh-pages
# bring gh-pages up to date with master
git rebase master
@ishu3101
ishu3101 / embed_ifttt.md
Created February 8, 2016 22:19
Embed IFTTT Recipes in Markdown

IFTTT Recipe:

IFTTT Recipe:

IFTTT Recipe: IFTTT Recipe:

IFTTT Recipe:

@ishu3101
ishu3101 / sendkeys.js
Created January 30, 2016 01:53
SendKeys Command To PowerShell
var o = new ActiveXObject("WScript.Shell");
//Force x86 Version
o.Run("C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe -windowstyle hidden");
WScript.Sleep(5000);
o.AppActivate("powershell");
o.SendKeys("Get-Process > output.txt {Enter}");
@ishu3101
ishu3101 / stdin.py
Last active July 21, 2016 05:35
How to read from stdin or from a file if no data is piped in Python.
# echo '{"_payload":{"navigationResult":{"list":[{"order_id":"2","date":"date"}]}}}' | python parser.py
# python parser.py --input input.json
# see: http://stackoverflow.com/questions/2264991/how-to-read-from-stdin-or-from-a-file-if-no-data-is-piped-in-python
import argparse
import json
def parse(json_data):
data = json.load(json_data)
resultlist = data['_payload']['navigationResult']['list']
@ishu3101
ishu3101 / gist_to_github_repo.md
Created November 24, 2015 08:35
Transfer a gist to a GitHub repository

Transfer a gist to a GitHub repository

clone the gist

git clone https://gist.github.com/ishu3101/6fb35afd237e42ef25f9

rename the directory

mv 6fb35afd237e42ef25f9 ConvertTo-Markdown

change the working directory to the newly renamed directory

cd ConvertTo-Markdown