Skip to content

Instantly share code, notes, and snippets.

View IshamMohamed's full-sized avatar
:shipit:
() => {}

Isham Mohamed IshamMohamed

:shipit:
() => {}
View GitHub Profile
[Unit]
Description=Long running service/daemon created from .NET worker template
[Service]
Type=notify
# will set the Current Working Directory (CWD). Worker service will have issues without this setting
WorkingDirectory=/srv/cisworker
# systemd will run this executable to start the service
ExecStart=/srv/cisworker/cis.worker.demo
# to query logs using journalctl, set a logical name here
@IshamMohamed
IshamMohamed / quickdenoserver.ts
Last active May 27, 2020 05:42
quickdenoserver.ts
import { serve } from "https://deno.land/std/http/server.ts";
const s = serve({ port: 80 });
console.log("http://localhost:80/");
for await (const req of s) {
req.respond({ body: "Hello World\n" });
}
[
{
"id": 1,
"vesselName": "AAL Bangkok",
"voyageInOut": "A14",
"berthNumber": "J15/16",
"estimateTimeOfBerting": "07102019 0600",
"estimateTimeOfUnberting": "08102019 1800",
"vesselLoa": "181.12",
"vesselDwt": "10.21",
@IshamMohamed
IshamMohamed / assign-blueprint.sh
Created October 31, 2019 05:38
cURL command to assign a Blueprint to Azure Management Group
#!/bin/bash
# Below is the cURL command to create or update a Blueprint in Azure
# According to documentation https://docs.microsoft.com/en-us/rest/api/blueprints/assignments/createorupdate,
# the particulat REST endpoint can accept either a subscription or a management group as the scope.
# The below was written to accept a management group
curl 'https://management.azure.com//providers/Microsoft.Management/managementGroups/Kloudynet/providers/Microsoft.Blueprint/blueprintAssignments/assignForMgmtGrp?api-version=2018-11-01-preview' -X PUT -H 'Authorization: Bearer [TOKEN]' -H 'DNT: 1' -H 'Content-Type: application/json' --data-binary $'{\n\u0009identity: {"type" : "SystemAssigned"},\n\u0009location: "southeastasia",\n\u0009properties:{"blueprintId":"providers/Microsoft.Management/managementGroups/Kloudynet/providers/Microsoft.Blueprint/blueprints/BP1", "parameters":{}, "resourceGroups":{}}\n}' --compressed
# But this throws a 404 HTTP response
# Error message - The requested resource was not found, is not
@IshamMohamed
IshamMohamed / VSCode_ContextMenu.reg
Created March 28, 2019 07:37
The reg script to make context menu item to open a folder in VS Code
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Users\\User\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Users\\User\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
from termcolor import colored
import subprocess as sp
import time
import sys
def delay_print(s):
for c in s:
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(0.05)
Option Explicit
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "taskkill /f /im Cscript.exe", , True
WshShell.Run "taskkill /f /im wscript.exe", , True
Set wshShell =wscript.CreateObject("WScript.Shell")
do
wscript.sleep 200
wshshell.sendkeys "{NUMLOCK}"
wscript.sleep 200
wshshell.sendkeys "{CAPSLOCK}"
wscript.sleep 200
wshshell.sendkeys "{SCROLLLOCK}"
loop
using System;
using System.Collections.Generic;
using System.Linq;
namespace ListListTest
{
class Program
{
static void Main(string[] args)
{
"markets" : ["US","CA","AT","AU","BE","CH","CN","DE","DK","FI","FR","GB","HK","MO","EU","IT","JP","MX","NL","NO","SE","LI", "AE","BR","IN","NZ","SG","KR","ZA","TW"],
"otherEU" : ["BG","CY","CZ","EE","GR","HR","HU","IS","LV","LT","LU","MT","PL","PT","RO","RU","SK","SI","ES","TR", "IE"],
"properties" : {
"AU" : {
"locale" : "en_AU",
"slug" : "en_AU",
"region" : "apac",
"language" : "en",
"paymentType" : "STRIPE",
"formattedDeposit" : "$1,500",