Skip to content

Instantly share code, notes, and snippets.

Avatar

Krona Emmanuel kronaemmanuel

View GitHub Profile
View system_setup.md

How to setup my system

This guide is supposed to serve as a guide for me, so that I can quickly setup a system anytime I need to do so. I should probably turn all this into an shell install script so it will automatically set that up for me. Or maybe use smth like NixOS. But until I figure all that out, here are the instructions. Here I'm setting up a Pop_OS system. Even though I love the dark side of linux (Arch, manjaro, etc). I need the 'debian' stability for development.

  1. Install a Pop_OS iso image from a usb stick. I pretty much always have a bootable Pop_OS usb on hand.
  2. Download all available updates
  3. Download the following from Pop Shop:
    • Spotify
    • VSCode
    • Kitty terminal
  4. Install the snap store:
@kronaemmanuel
kronaemmanuel / TwoBitAdder.py
Created May 19, 2021
Two Bit Adder Circuit With Qiskit
View TwoBitAdder.py
# We need 4 qubits for input, 7 for processing and 3 output bits
tba = QuantumCircuit(11, 3)
# Step 1: encode
# Here's how numbers are entered: E.g. 10 + 01 = 11
# q_0 = 0 and q_1 = 1 represent first number
# q_2 = 1 and q_3 = 0 represent second number
#tba.x(0) # For a=0, remove the this line. For a=1, leave it.
tba.x(1) # For b=0, remove the this line. For b=1, leave it.
tba.x(2) # For a=0, remove the this line. For a=1, leave it.
#tba.x(3) # For b=0, remove the this line. For b=1, leave it.
@kronaemmanuel
kronaemmanuel / main.md
Last active Sep 14, 2020
Tor Project: OONI Explorer - Social Media Sharing
View main.md

My goals

  • Better meta tags for OONI Explorer
  • og:image for both country and measurement pages
  • Share button to share measurements
  • Implement tests for all the components added
  • Research and improve SEO

What is done

  • Better meta tags for country pages implemented
    • PR merged
@kronaemmanuel
kronaemmanuel / render.js
Created Jun 21, 2020
Nivo chart Render
View render.js
const React = require('react')
const { renderToStaticMarkup } = require('react-dom/server')
const { Bar } = require('nivo')
const storage = require('../../utils/storage')
const theme = {}
const render = (props) => {
const rendered = renderToStaticMarkup(
React.createElement(
Bar,
@kronaemmanuel
kronaemmanuel / storage.js
Created Jun 21, 2020
Nivo chart Storage
View storage.js
'use strict'
const store = {}
exports.set = (key, value) => {
store[key] = value
}
exports.get = key => {
return store[key]
@kronaemmanuel
kronaemmanuel / chart.js
Created Jun 21, 2020
Nivo chart POST request handler
View chart.js
const storage = require('./storage')
const uuid = require('uuid')
const express = require('express')
const server = express()
server.post('/chart', (req, res) => {
// Get all the data and parameters for the chart
const props = req.body
// Generate a random id for the chart
@kronaemmanuel
kronaemmanuel / data.js
Created Jun 21, 2020
Nivo Bar Chart Data
View data.js
[
{
"country": "AD",
"hot dog": 49,
"hot dogColor": "hsl(151, 70%, 50%)",
"burger": 16,
"burgerColor": "hsl(91, 70%, 50%)",
"sandwich": 110,
"sandwichColor": "hsl(285, 70%, 50%)",
"kebab": 136,
@kronaemmanuel
kronaemmanuel / bar.jsx
Last active Jun 21, 2020
Nivo Bar Chart
View bar.jsx
import { ResponsiveBar } from '@nivo/bar'
// Code for Bar chart
const MyResponsiveBar = ({ data }) => (
<ResponsiveBar
data={data}
keys={[ 'hot dog', 'burger', 'sandwich', 'kebab', 'fries', 'donut' ]}
indexBy="country"
margin={{ top: 50, right: 130, bottom: 50, left: 60 }}
padding={0.3}
@kronaemmanuel
kronaemmanuel / nextHead.jsx
Created Jun 13, 2020
Next Head's basic usage
View nextHead.jsx
import Head from { next/head }
// A high level App component
const App = () => {
return(
<Head>
// Page will have "My App" as its title initially
<meta property="title" content="My App" key="title" />
</Head>
<Details />
@kronaemmanuel
kronaemmanuel / twelve_days_of_xmas.rs
Last active Feb 14, 2021
Twelve Days of Christmas Poem on console with Rust
View twelve_days_of_xmas.rs
fn main() {
twelve_days_of_xmas();
}
fn twelve_days_of_xmas(){
let days = ["first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth"];
for (day_num, day) in days.iter().enumerate() {
println!("For the {} day of Christmas my true love sent to me", day);