Skip to content

Instantly share code, notes, and snippets.

@sirenko
sirenko / *elisp*.el
Created September 2, 2022 21:53
Display 24h time (with seconds) in Emacs modeline
(setq display-time-24hr-format t
display-time-format "%I:%M:%S"
display-time-interval 1)
@sirenko
sirenko / USCIS-civics-test-100-questions.org
Created August 31, 2022 00:24
org-drill for "Civics (History and Government) Questions for the Naturalization Test"

Civics (History and Government) Questions for the Naturalization Test

(rev. 01/19)

Civics (History and Government) Questions for the Naturalization Test

The 100 civics (history and government) questions and answers for the naturalization test are listed below. The civics test is an oral test and the USCIS Officer will ask the applicant up to 10 of the 100 civics questions. An applicant must answer 6 out of 10 questions correctly to pass the civics portion of the naturalization test.

Marty Lobdell - Study Less Study Smart - YT video

  1. Don’t study for too long if you are not enjoying it. Take short breaks after 20-30 minutes.
  2. Don’t study in the living room, bedroom, etc. Study in a separate place dedicated to studying.
  3. Don’t try to memorize without understanding. Try to understand the concept first.
  4. Don’t always study alone. Studying in groups helps a lot.
  5. Don’t highlight text blindly. Highlighting doesn’t help that much. It only indicates Recognization not Recollection of the topic.
  6. Always take notes. Reviewing the notes after a short time helps a lot.
  7. Always try to teach others what you have learned. Teaching is the best way of learning.
  8. Sleep is so much important for pushing something into your long-term memory. Get at least 7-8 hours of sound sleep.

Xfinity 1.2TB data cap translated into the monthly traffic bytes/sec

(file-size-human-readable-iec (/ (* 1.2 (expt 10 12))
                                 (* 30 24 60 60)))

CSES Problem Set

This document contains a numbered list of all the problems from the CSES Problem Set. Two ordinal numbers are mentioned against each problem. The first number shows the position of the problem in the entire problem set. The second number shows the position of the problem within a section.

Problems

import (
"reflect"
"runtime"
"strings"
)
// GetFuncName returns function name referenced by 'f'
func GetFuncName(f interface{}) string {
return strings.Split(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name(), ".")[1]
}
while true; do { echo -e "HTTP/1.0 200 OK\n\n $(date)" | nc -l -p 9090 -c }; done
# One line web-server for Shell (bash, zsh) returning current date and time.
# It's good enough to mimic k8s service.
# The server could be executed in busybox docker image/container.
@sirenko
sirenko / go-builder-pattern.go
Last active June 28, 2021 23:14 — forked from vaskoz/builder.go
Golang Builder pattern
// Go, builder design pattern
//
// Go playground URL: https://play.golang.org/p/ArweZ3i7Puc
package main
import "strconv"
import "fmt"
type Color string
// Design Pattern: functional options
//
// Go playground URL: https://play.golang.org/p/FiUmbyqEZgd
//
// References:
// Rob Pike, Self-referential functions and the design of options: https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html
// Dave Cheney; Functional options for friendly APIs: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
// Functional options on steroids, Márk Sági-Kazár: https://sagikazarmark.hu/blog/functional-options-on-steroids/
package main
youtube-dl --sub-lang en --write-auto-sub --sub-format srt --skip-download 'https://www.youtube.com/watch?v=AAABBBCCCDDD'