Skip to content

Instantly share code, notes, and snippets.

View nasirhm's full-sized avatar
😀
404 Not Found

Nasir Hussain nasirhm

😀
404 Not Found
View GitHub Profile
@alcol80
alcol80 / btrfs-nixos-install.sh
Last active October 22, 2023 12:25
nixos install (boot + btrfs root + btrfs docker)
gdisk /dev/sda # make 1 partition
mkfs.vfat -n BOOT /dev/sda1
mkfs.btrfs -L root /dev/sdb
mkfs.btrfs -L docker /dev/sdc
mount -t btrfs -o noatime,discard,ssd,autodefrag,compress=lzo,space_cache /dev/sdb /mnt/
btrfs subvolume create /mnt/nixos
umount /mnt/
mount -t btrfs -o noatime,discard,ssd,autodefrag,compress=lzo,space_cache,subvol=nixos /dev/sdb /mnt/
@julz
julz / main.go
Created November 20, 2015 12:39
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bind.dnsutils -p traceroute -p curl
# impure: needs ping
#source: https://s3.amazonaws.com/aws-cloudfront-testing/CustomerTesting.html
function _e {
echo "> $@"
eval "$@" 2>&1 | sed -e "s/^/ /"
printf "Exit: %s\n\n\n" "$?"
}

Q.1

The speed limit of Shahrah-e-Faisal is 60 km/hr. Write a program that, given a car's speed, tells whether it is Overspeeding or not.


Q.2

Your task is to develop a mini-facebook. If the user is logged in, it should print Welcome, <user's name>, otherwise it should print Please log in to continue!


@gaearon
gaearon / modern_js.md
Last active July 18, 2024 10:37
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@sinclairtarget
sinclairtarget / bernoulli.c
Created August 17, 2018 20:22
Lovelace's Note G Program in C
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
@ignatenkobrain
ignatenkobrain / README.md
Last active November 9, 2020 10:13
Rust on Side Tags
set release 32
set build (fedpkg verrel)
set pkg (string split -m 2 -r - $build)[1]
set tag (koji add-sidetag f$release-build)

fedpkg clone $pkg
cd $pkg
fedpkg request-branch f$release --no-git-branch
@AhsanAyaz
AhsanAyaz / fb-friend-requests-automation.js
Last active January 24, 2022 17:44
Automagically accept all friend requests on your profile
/**
* @author Muhammad Ahsan Ayaz
* Usage:
* Go to https://www.facebook.com/friends/requests/
* Run the following code
*/
function removeFriendRequest({row, removeRequests, counter, timerDelay}) {
if (removeRequests) {
const removeButton = row.closest('a').querySelector('[aria-label="Remove"]:not([aria-disabled="true"])')