Skip to content

Instantly share code, notes, and snippets.

View ak9999's full-sized avatar
🎯
Focusing

Abdullah "AJ" Khan ak9999

🎯
Focusing
  • New York
View GitHub Profile
@ak9999
ak9999 / get_complaint_data.py
Created February 2, 2020 14:56
Just grabbing JSON data from NYPD Complaint Data Historic from NYC Open Data, and pretty print it. Link: https://data.cityofnewyork.us/Public-Safety/NYPD-Complaint-Data-Historic/qgea-i56i
import json
from datetime import *
import pprint
from dateutil.relativedelta import *
from dateutil.parser import *
import requests
import pytz
EASTERN_TZ = pytz.timezone('US/Eastern')
@ak9999
ak9999 / not_twosum.py
Created February 2, 2020 14:53
Return two numbers that add up to a target sum.
from typing import List
def twoSum(nums: List[int], target: int) -> List[int]:
answers = []
for n in nums:
answers.append(target - n)
ans = set(answers) & set(nums)
return ans
@ak9999
ak9999 / download_example.go
Created December 29, 2019 23:10
Downloads a file and saves it to a given location.
package main
import (
"fmt"
"io"
"net/http"
"os"
)
// DownloadFile will download a url to a local file.
@ak9999
ak9999 / DefineLocalAdminAccount.ps1
Created September 21, 2019 23:51
Create or update a local administrator account, optionally choosing username and password.
param([string]$username='LocalAdministrator',[string]$password='P@ssw0rd!')
$secure_password = $password | ConvertTo-SecureString -AsPlainText -Force
try {
$LocalUserObject = Get-LocalUser -Name $username -ErrorAction Stop
}
catch [Microsoft.PowerShell.Commands.UserNotFoundException] {
"User $($username) Not Found" | Write-Warning
}
@ak9999
ak9999 / UninstallLabTechAgent.ps1
Created September 21, 2019 23:48
Uninstall LabTech and ScreenConnect Agents: For those who are having a hard time uninstalling the LabTech Agent from their computer, the first script will remove the LabTech Agent, and the second will remove ScreenConnect aka (ConnectWise Control).
$url = "https://s3.amazonaws.com/assets-cp/assets/Agent_Uninstaller.zip"
$output = "C:\Windows\Temp\Agent_Uninstaller.zip"
(New-Object System.Net.WebClient).DownloadFile($url, $output)
# The below usage of Expand-Archive is only possible with PowerShell 5.0+
# Expand-Archive -LiteralPath C:\Windows\Temp\Agent_Uninstaller.zip -DestinationPath C:\Windows\Temp\LTAgentUninstaller -Force
# Use .NET instead
[System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null
# Now we can expand the archive
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\Windows\Temp\Agent_Uninstaller.zip', 'C:\Windows\Temp\LTAgentUninstaller')
Start-Process -FilePath "C:\Windows\Temp\LTAgentUninstaller\Agent_Uninstall.exe"
from csv import reader
from collections import namedtuple
import logging
import subprocess
# TODO: In the future this script should also possibly generate the data so that no other steps are required.
# E.g.:
# gam all users show filelist id alternateLink query "'user@example.com' in readers" > file.csv
# gam all users show filelist id alternateLink query "'user@example.com' in writers" > file.csv
@ak9999
ak9999 / reset_audio_levels.bat
Created March 31, 2019 21:59
reset_audio_levels.bat
@ECHO OFF
ECHO Reset Volume Mixer Settings...
NET STOP Audiosrv
NET STOP AudioEndpointBuilder
REG DELETE "HKCU\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore" /F
REG ADD "HKCU\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore"

Keybase proof

I hereby claim:

  • I am ak9999 on github.
  • I am ajkhan (https://keybase.io/ajkhan) on keybase.
  • I have a public key ASAXKi_dzF89sSnug3xUVRAZ7bXl_w4YMBhPD96B_66_qwo

To claim this, I am signing this object:

@ak9999
ak9999 / create_mojave_iso.py
Created January 20, 2019 17:57
Simple script written for fun that creates a macOS Mojave ISO.
#!/usr/bin/env python3
"""
This script creates a macOS Mojave bootable ISO.
Requires Python 3.6, macOS, and macOS Mojave app installed.
Created using info gathered from here: https://gist.github.com/agentsim/00cc38c693e7d0e1b36a2080870d955b
Purpose: I just wanted to try out the subprocess library.
"""
@ak9999
ak9999 / DisplayLinkManager.log
Created September 28, 2018 17:17
Output from /var/log/displaylink/DisplayLinkManager.log for displaylink-debian
UVLY+3xs9LIslFFJL9zz9ZX/E8tch0h1gXBEL4FgoejQ9yQ/0abH8BYtlJeU1ADc3SFuE3w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