Skip to content

Instantly share code, notes, and snippets.

View sameer's full-sized avatar

Sameer Puri sameer

View GitHub Profile
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
/**
*
* @author Robotia
*/
public class MapBucketTesting
@sameer
sameer / x11clients.sh
Created November 23, 2016 01:26
Count X11 Clients
#!/bin/bash
lsof -U | grep -i socket | cut -d ' ' -f 1 | sort | uniq -c
@sameer
sameer / run-if-enough-battery.sh
Created November 28, 2016 17:16
Script that runs only if battery > 50% (tested on Ubuntu 16.04 4.4.0-47-generic)
#!/bin/bash
command() {
# enter command here
}
POWER=`upower -i $(upower -e | grep BAT) | grep --color=never -E percentage|xargs|cut -d' ' -f2|sed s/%//`
if [ "$POWER" -gt "50" ]
then
command
else
echo "Refusing to run command, battery is low."
@sameer
sameer / plan9palette.go
Last active January 18, 2024 19:45
Creates a Plan 9 Palette as a 2D image using the gg library
import (
"github.com/fogleman/gg"
"image/color/palette"
"strconv"
"image/color"
)
func main() {
const numSquaresPerRow = 16.
const numSquaresPerColumn = numSquaresPerRow
Resource Utilization by Entity report for hdmi-demo
Sat Feb 8 21:50:00 2020
Quartus Prime Version 19.1.0 Build 670 09/22/2019 SJ Lite Edition
---------------------
; Table of Contents ;
---------------------
1. Legal Notice
2. Fitter Resource Utilization by Entity
@sameer
sameer / SerialNINAPassthrough.ino
Last active April 16, 2020 23:47
SerialNINAPassthrough sketch in working condition for MKR Vidor 4000 (https://forum.arduino.cc/index.php?topic=675947.0) (based on PRs 112, 111, 110, 109) https://github.com/arduino-libraries/WiFiNINA/pulls
/*
SerialNINAPassthrough - Use esptool to flash the u-blox NINA (ESP32) module
Arduino MKR WiFi 1010, Arduino MKR Vidor 4000, and Arduino UNO WiFi Rev.2.
Copyright (c) 2018 Arduino SA. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Plaintext:
LAWS OF UX
01. Aesthetic Usability Effect: Users often perceive aesthetically pleasing design as design that’s more usable.
02. Doherty Threshold: Productivity soars when a computer and its users interact at a pace (<400ms) that ensures that neither has to wait on the other.
03. Fitts’s Law: The time to acquire a target is a function of the distance to and size of the target.
File {
percents: [],
lines: [
(
Line {
line_components: [
LineComponent {
field: Some(
Field {
letters: "G",
00
0a
.-=-. .--.
__ .' '. / " )
_ .' '. / .-. \ / .-'0c\0a
( \ / .-. \ / / \ \ / / 0c^0a
\ `-` / \ `-' / \ `-` /
`-.-` '.____.' `.____.'
07
const RECT_TAG_NAME: &str = "rect";
const CIRCLE_TAG_NAME: &str = "circle";
const ELLIPSE_TAG_NAME: &str = "ellipse";
const LINE_TAG_NAME: &str = "line";
RECT_TAG_NAME => {
let x = self.length_attr_to_user_units(&node, "x").unwrap_or(0.);
let y = self.length_attr_to_user_units(&node, "y").unwrap_or(0.);
let width = self.length_attr_to_user_units(&node, "width");
let height = self.length_attr_to_user_units(&node, "height");