Skip to content

Instantly share code, notes, and snippets.

View zaynkorai's full-sized avatar
:shipit:

Zayn-ul-Abdin zaynkorai

:shipit:
  • Hunza Cloud
  • Karachi, Sindh, Pakistan
View GitHub Profile
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
type Header struct {
LicenseId int `xml:"hps:LicenseId"`
SiteId int `xml:"hps:SiteId"`
DeviceId int `xml:"hps:DeviceId"`
UserName string `xml:"hps:UserName,omitempty"`
Password string `xml:"hps:Password,omitempty"`
CredentialToken string `xml:"hps:CredentialToken,omitempty"`
SiteTrace string `xml:"hps:SiteTrace,omitempty"`
DeveloperID string `xml:"hps:DeveloperID,omitempty"`
@zaynkorai
zaynkorai / 222
Last active November 5, 2019 13:01
7.1
I mentioned that the microcontroller has several pins. For convenience, these pins are grouped in ports of 16 pins. Each port is named with a letter: Port A, Port B, etc. and the pins within each port are named with numbers from 0 to 15.
The manual says:
LD3, the North LED, is connected to the pin PE9. PE9 is the short form of: Pin 9 on Port E.
LD7, the East LED, is connected to the pin PE11.
Up to this point, we know that we want to change the state of the pins PE9 and PE11 to turn the North/East LEDs on/off.
Each peripheral has a register block associated to it. A register block is a collection of registers allocated in contiguous memory. The address at which the register block starts is known as its base address. We need to figure out what's the base address of the GPIOE peripheral.
@zaynkorai
zaynkorai / task.sql
Created September 13, 2019 23:14
Sample Task SQL
#Task 1
ALTER TABLE mapping
ADD CONSTRAINT mapping_fk_1 FOREIGN KEY (user_id) REFERENCES users (id),
ADD CONSTRAINT mapping_fk_2 FOREIGN KEY (program_id) REFERENCES programs (id);
#Task 2
Select u.name as 'User', p.name as 'Program' from users u
INNER JOIN mapping m ON u.id = m.user_id
INNER JOIN programs p on m.program_id = p.id;
-- Rust is a statically typed language, which means that it must know the types of all variables at compile time. The compiler can usually infer what type we want to use based on the value and how we use it. // &T
-- fn main() {
let mut x = "A";
let x = x.len();
println!("{}",x);
} //compile error
@zaynkorai
zaynkorai / servo logs output
Created May 31, 2019 07:20
servo logs output
Compiling servo v0.0.1 (/home/zayn/rus/servo/ports/glutin)
error: linking with `cc` failed: exit code: 1
|=================> ] 635/636: servo(bin) = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/zayn/.rustup/toolchains/nightly-2019-05-14-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/zayn/rus/servo/target/debug/deps/servo-525bfad36272f001.101kwtrpci6xd0qy.rcgu.o" "/home/zayn/rus/servo/target/debug/deps/servo-525bfad36272f001.107l0hz9lrp0owhi.rcgu.o" "/home/zayn/rus/servo/target/debug/deps/servo-525bfad36272f001.10neou9wlov1exon.rcgu.o" "/home/zayn/rus/servo/target/debug/deps/servo-525bfad36272f001.113i36a39nhn3b1k.rcgu.o" "/home/zayn/rus/servo/target/debug/deps/servo-525bfad36272f001.12w2ow3pq0cxaesg.rcgu.o" "/home/zayn/rus/servo/target/debug/deps/servo-525bfad36272f001.147h9f2zy1nij04b.rcgu.o" "/home/zayn/rus/servo/target/debug/deps/servo-525bfad36272f001.14jfluol37x8gs6v.rcgu.o" "/home/zayn/rus/servo/target/debug/deps/servo-525bfad36272f001.156v5n5kw9
@zaynkorai
zaynkorai / init.pp
Last active April 9, 2019 07:41
Your fundamentals are quite weak: Puppet
class create-user {
user { 'mruser':
ensure => present,
password => '$1$yQixQXAQ$KtkZXYx5wFMqZaUgXeXDN/',
home => '/home/mruser',
}
}
@zaynkorai
zaynkorai / pipost.md
Last active March 13, 2019 18:40
Post installation raspberry pi

THE BASIC

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install avahi-daemon 

Node Server

@zaynkorai
zaynkorai / .bashrc
Last active March 11, 2019 11:59
shell scripts
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Path to the bash it configuration
export BASH_IT="/home/korai/.bash_it"