Skip to content

Instantly share code, notes, and snippets.

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

Stardustclub ssghost

🏠
Working from home
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ssghost
ssghost / BVA.py
Created December 31, 2019 06:29
Cirq: Demonstrates the Bernstein–Vazirani algorithm.
"""Demonstrates the Bernstein–Vazirani algorithm.
The (non-recursive) Bernstein–Vazirani algorithm takes a black-box oracle
implementing a function f(a) = a·factors + bias (mod 2), where 'bias' is 0 or 1,
'a' and 'factors' are vectors with all elements equal to 0 or 1, and the
algorithm solves for 'factors' in a single query to the oracle.
=== EXAMPLE OUTPUT ===
Secret function:
f(a) = a·<0, 0, 1, 0, 0, 1, 1, 1> + 0 (mod 2)
Sampled results:
@ssghost
ssghost / lost_alert.py
Last active April 2, 2020 10:26
If I lost in China for 3 days, this Telegram bot will automatically send my personal information to my best friends for seeking rescues.
from telegram import Bot
from threading import Timer
from eventlet import Timeout
def main(bot):
while True:
update = bot.getUpdates()[-1]
if update.message.text == '/start':
timer = Timer(60*60*24*3, post_alert, args=[bot,update])
timer.start()

My WebApplication TechStack

Web Apps

Mobile Apps

  • PY Kivy: My_Kivy
  • TS React Native: NS_TS_RCT
@ssghost
ssghost / button-hover.markdown
Created December 13, 2020 12:08
Button Hover
@ssghost
ssghost / ethereum-payment-metamask.html
Last active January 13, 2022 02:22 — forked from ksaitor/ethereum-payment-metamask.html
How to add Ethereum payments to your site with MetaMask
<div>
<button class="pay-button">Pay</button>
<div id="status"></div>
</div>
<script type="text/javascript">
window.addEventListener('load', async () => {
if (window.ethereum) {
window.web3 = new Web3(ethereum);
try {
await ethereum.enable();
@ssghost
ssghost / react-gamepad-test.js
Last active November 30, 2021 15:50
A react gamepad initialising and rendering demo script, forked from @danba340
import { useState } from 'react';
import { useGamepads } from 'react-gamepads';
import './App.css';
const buttonLabels = [
"A",
"B",
"X",
"Y",
"L1",
@ssghost
ssghost / update-golang.md
Created February 9, 2022 20:20 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by: