Skip to content

Instantly share code, notes, and snippets.

View spurgeonbj's full-sized avatar
🏠
Working from home

Spurgeon spurgeonbj

🏠
Working from home
  • India
View GitHub Profile
@jramnai
jramnai / commands.md
Last active March 12, 2024 21:04
Useful commands in Open edX

Useful commands in Open edX

Change access permission of pem file

sudo chmod 400 my_private_key.pem  

SSH into your server

ssh -i my_private_key.pem ubuntu@ 
@abobija
abobija / wsl2-ubuntu-lamp.md
Last active May 3, 2024 12:10
LAMP stack on WSL2 (Ubuntu 20.04) - Apache, MySQL, PHP, PhpMyAdmin

LAMP stack on WSL2 (Ubuntu 20.04) - Apache, MySQL, PHP, PhpMyAdmin

Apache

sudo apt-get update && sudo apt-get upgrade 
sudo apt-get install -y apache2

PHP

@DKrepsky
DKrepsky / Enable bridge network android studio emulator.md
Last active April 18, 2023 16:27
Enable bridge network Android Studio Emulator

sudo ip tuntap add dev tap0 mode tap group kvm sudo brctl addif br0 tap0 sudo ip link set dev tap0 up promisc on #sudo sysctl -w net.ipv4.ip_forward=1

emulator -avd Pixel_3a_API_30_x86 -netfast -accel auto -qemu -device virtio-net,netdev=net0,mac=52:55:00:d1:55:51 -netdev tap,id=net0,ifname=tap0,script=no,downscript=no

adb root

@KEINOS
KEINOS / md5.gs
Last active March 20, 2024 04:05
GAS(Google Apps Script) user function to get MD5 hash or 4digit shortened hash for Multibyte(UTF-8, 2bytes character) environment.
/**
* ------------------------------------------
* MD5 function for GAS(GoogleAppsScript)
*
* You can get a MD5 hash value and even a 4digit short Hash value of a string.
* ------------------------------------------
* Usage1:
* `=MD5("YourStringToHash")`
* or
* `=MD5( A1 )`
@0xjac
0xjac / private_fork.md
Last active May 18, 2024 21:41
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@pixeline
pixeline / mirror_remote_directory_to_local_directory
Last active September 28, 2023 09:46
Bash script using lftp to mirror remote directory to local directory, thus keeping the local directory synchronized with the remote one.
#!/bin/sh
# @author: Alexandre Plennevaux
# @description: MIRROR DISTANT FOLDER TO LOCAL FOLDER VIA FTP
#
# FTP LOGIN
HOST='sftp://ftp.domain.com'
USER='ftpusername'
PASSWORD='ftppassword'
# DISTANT DIRECTORY
@karlkranich
karlkranich / apitest.php
Last active July 17, 2018 14:49
Updated PHP code to use the Google Sheets API. See usage instructions at http://karl.kranich.org/2015/04/16/google-sheets-api-php/ More examples at https://gist.github.com/karlkranich/afa39e3d778455b38c38
<?php
// apitest.php
// by Karl Kranich - karl.kranich.org
// version 3.1 - edited query section
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php');
include_once "google-api-php-client/examples/templates/base.php";
$client = new Google_Client();
@ralavay
ralavay / vim-nginx-conf-highlight.sh
Last active April 21, 2024 03:58
Enable syntax highlight for Nginx conf file in Vim
#!/bin/bash
#
# Highligh Nginx config file in Vim
# Download syntax highlight
mkdir -p ~/.vim/syntax/
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim
# Set location of Nginx config file
cat > ~/.vim/filetype.vim <<EOF
@karlkranich
karlkranich / sheets-api-test-part2.php
Last active February 2, 2023 21:39
(obsolete due to Google changes) PHP code to use the Google Spreadsheets API with an OAuth Service Account. For more info, see http://karl.kranich.org/google-sheets-api-php
<?php
// Section 5: edit a row
// You'll need to get the etag and row ID, and send a PUT request to the edit URL
$rowid = 'cre1l'; // got this and the etag from the table data output from section 3
$etag = 'NQ8VCRBLVCt7ImA.';
$url = "https://spreadsheets.google.com/feeds/list/$fileId/od6/private/full/$rowid";
$method = 'PUT';
$headers = ["Authorization" => "Bearer $accessToken", 'Content-Type' => 'application/atom+xml', 'GData-Version' => '3.0'];
$postBody = "<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:gsx=\"http://schemas.google.com/spreadsheets/2006/extended\" xmlns:gd=\"http://schemas.google.com/g/2005\" gd:etag='&quot;$etag&quot;'><id>https://spreadsheets.google.com/feeds/list/$fileid/od6/$rowid</id><gsx:gear>phones</gsx:gear><gsx:quantity>6</gsx:quantity></entry>";
$req = new Google_Http_Request($url, $method, $headers, $postBody);
@zspine
zspine / world-countries
Last active October 15, 2022 02:29
World Countries - iso2, iso3, nationality, code and phone prefix
{
"AF": {
"name": "Afghanistan",
"iso2": "AF",
"iso3": "AFG",
"nationality": "Afghan",
"code": "004",
"prefix": "93"
},
"AL": {