Skip to content

Instantly share code, notes, and snippets.

View Rizwan-Hasan's full-sized avatar
🌏
Working remotely

Rizwan Hasan Rizwan-Hasan

🌏
Working remotely
View GitHub Profile
@Rizwan-Hasan
Rizwan-Hasan / create-package.md
Created August 17, 2021 20:19 — forked from deanrather/create-package.md
Creating a .deb Package

Creating a .deb Package

This creates a package which runs an install.sh which copies a file somewhere the below is entirely incorrect. Hopefully I'll get around to fixing it tip: this would install to the root dir & the relative path to ./install.sh would be wrong

go to project directory

cd /path/to/project
@Rizwan-Hasan
Rizwan-Hasan / Javascript CustomEvent Example.js
Created August 1, 2021 12:11
A simple example of JavaScript CustomEvent
const event_target = new EventTarget();
event_target.addEventListener('asuna_yuuki', event => console.log(event.detail));
event_target.addEventListener('rize_kamishiro', event => console.log(event.detail));
event_target.dispatchEvent(
new CustomEvent('asuna_yuuki', {
detail: {
data: 'Asuna Yuuki',
},
@Rizwan-Hasan
Rizwan-Hasan / dev.conf
Created March 7, 2021 16:42 — forked from fnando/dev.conf
Nginx configuration for SSH tunnel
upstream tunnel {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name dev.codeplane.com br.dev.codeplane.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
# Put this file in /etc/nginx/sites-available
# Then "ln -s /etc/nginx/sites-available/aria2-nginx.conf /etc/nginx/sites-enabled"
# Then "sudo service nginx restart"
server {
listen 80;
listen [::]:80;
root /var/www/aria2; # Put your aria2 web ui here, such as AriaNg
index index.html;
server_name DOMAIN_NAME;
location / {
@Rizwan-Hasan
Rizwan-Hasan / Base64.js
Created February 14, 2021 12:42 — forked from alkaruno/Base64.js
Base64 encode & decode (only for numbers) in JavaScript
var Base64 = (function () {
var ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var Base64 = function () {};
var _encode = function (value) {
if (typeof(value) !== 'number') {
throw 'Value is not number!';
@Rizwan-Hasan
Rizwan-Hasan / git-io-custom-url.md
Created December 21, 2020 16:22 — forked from dikiaap/git-io-custom-url.md
git.io custom URL

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
# ~/.config/systemd/user/jupyter.service
[Unit]
Description=An interactive python notebook server
After=network.target

[Service]
ExecStart=/usr/bin/jupyter notebook\
    --no-browser\
 --port=8001\
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1 align="center">Redirecting in <span id="countdown">10</span> seconds</h1>
<script type="text/javascript">
// Total seconds to wait
var seconds = 10;
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 1080))
message = ''
while True:
msg = s.recv(1)
if len(msg) <= 0:
break
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('localhost', 1080))
s.listen()
message = "Hello World"
message = bytes(message, "utf-8")
while True: