Skip to content

Instantly share code, notes, and snippets.

View hsali's full-sized avatar

Hafiz Shehbaz Ali hsali

View GitHub Profile
@jcheong0428
jcheong0428 / synchrony_tutorial.ipynb
Last active February 12, 2024 11:33
Synchrony tutorial notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active July 5, 2021 18:58
SSH into Linux Subsystem for Windows
  • In /etc/ssh/sshd_conf, set UsePrivilegeSeparation to no
  • In /etc/ssh/sshd_conf, temporarily enable plaintext passwords
  • In /etc/ssh/sshd_conf, change port (e.g. to 23) to avoid confusion with Windows SSH server
  • sudo service ssh restart
  • Add alternative port as a new rule to Windows firewall
  • On the client: ssh-copy-id user@server
  • In /etc/ssh/sshd_conf, re-disable plaintext passwords

To fix Could not load host key ... error:

  • sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
@hsali
hsali / create_subdomain_cpanel.php
Created March 24, 2017 13:32
PHP Script to create subdomain on cpanel .
function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain) {
// $buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain;
$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/subdomains/" . $subDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket) {
return "Socket error";
exit();
@hsali
hsali / active-issues.sql
Created January 25, 2017 12:04 — forked from alysonla/active-issues.sql
Queries that power the open source section of the 2016 Octoverse report https://octoverse.github.com/
-- Active issues
-- Count of total active issues in the specified time frame
-- Source: githubarchive public data set via Google BigQuery http://githubarchive.org/
SELECT
COUNT(DISTINCT JSON_EXTRACT_SCALAR(events.payload, '$.issue.id')) AS events_issue_count
FROM (SELECT * FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31')))
AS events
-- 10,723,492 active issues
@alysonla
alysonla / active-issues.sql
Last active September 19, 2023 11:21
Queries that power the open source section of the 2016 Octoverse report https://octoverse.github.com/2016/
-- Active issues
-- Count of total active issues in the specified time frame
-- Source: githubarchive public data set via Google BigQuery http://githubarchive.org/
SELECT
COUNT(DISTINCT JSON_EXTRACT_SCALAR(events.payload, '$.issue.id')) AS events_issue_count
FROM (SELECT * FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31')))
AS events
-- 10,723,492 active issues
@olilau
olilau / odoo_upgrade_request.sh
Last active October 1, 2021 09:40
Creates an Odoo upgrade request and uploads the database dump using SFTP.
#!/bin/bash
set -e
VERSION="0.3"
MAX_CMD_TRIES=30
MAX_SFTP_TRIES=100
# check sftp has the "put -a" command:
if man sftp | grep ' put.*local-path.*remote-path' | grep -q afPpr ;
@davidrushton
davidrushton / Kernel.php
Created February 17, 2016 17:29
Laravel 5 Database Queue - Shared Hosting
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
@seksenov
seksenov / cortana.html
Last active May 28, 2022 21:51
Cortana integration from a hosted web app on Windows. To do this you'll need a meta tag in your html page pointint to an xml voice command definition file on your server. You'll also need to handle the Cortana activation event in your JavaScript.
<!DOCTYPE html>
<html>
<head>
<title>Cortana Example</title>
<!--Cortana meta tag pointing to VCD file on the server-->
<meta name="msapplication-cortanavcd" content="https://mysite.com/vcd.xml"/>
</head>
<body>
</body>
@tinkerware
tinkerware / Vagrant provision block
Last active January 21, 2019 01:11
Install Latest Java 7 and Java 8 on Ubuntu 14.04 LTS
config.vm.provision "shell", inline: <<-SHELL
apt-get -y -q update
apt-get -y -q upgrade
apt-get -y -q install software-properties-common htop
add-apt-repository ppa:webupd8team/java
apt-get -y -q update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt-get -y -q install oracle-java8-installer
apt-get -y -q install oracle-java7-installer
@cacycleworks
cacycleworks / git_update.sh
Last active February 18, 2023 23:41
Simple sh script to automate a git update
#!/bin/sh
if [ $# != 2 ]; then
echo "\nchris k's git update automater sh script. Edit to put a bunch of \`git add blah'"
echo "lines in the body then evoke with the branch name and commit description\n"
echo "Usage: $0 <branch_name> <\"Description of update\">\n"
echo " branch_name: the name of the git branch to be created"
echo " Description: Text for: git commit -m \"Description of update\""
echo ""
echo "Example:"
BRANCH="core_override"